openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #01421
[Merge] lp:~openerp-dev/openobject-addons/ron-dev-addons2 into lp:~openerp-dev/openobject-addons/trunk-dev-addons2
ron(openerp) has proposed merging lp:~openerp-dev/openobject-addons/ron-dev-addons2 into lp:~openerp-dev/openobject-addons/trunk-dev-addons2.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
#606325 EAN code validation fails
https://bugs.launchpad.net/bugs/606325
#627936 mrp: procurement from orderpoints is generated for non-active, non-purchasable products (5.0)
https://bugs.launchpad.net/bugs/627936
#663890 Creating invoices and grouping multiplies services
https://bugs.launchpad.net/bugs/663890
#666362 [6.0RC1] sale Invoice Control "Not from Picking" is bad wording
https://bugs.launchpad.net/bugs/666362
#667246 Wrong Journals when creating an invoice from picking
https://bugs.launchpad.net/bugs/667246
#667324 invoicing control in purchase orders
https://bugs.launchpad.net/bugs/667324
#669210 [trunk][mrp] stock_move.action_consume raises exception
https://bugs.launchpad.net/bugs/669210
#670056 [6.0RC1] stock moves - missing search field "Reference"
https://bugs.launchpad.net/bugs/670056
#670652 Demo data of purchase order is not relevant in terms of supplier address
https://bugs.launchpad.net/bugs/670652
#670921 Purchase module : problems in group by in seach view
https://bugs.launchpad.net/bugs/670921
#671172 Return packingnumber hardcoded {'name':'%s (return)' % pick.name
https://bugs.launchpad.net/bugs/671172
#671386 PO Line description doesn't take Supplier Product Name or Code in Product's Suppliers Tab
https://bugs.launchpad.net/bugs/671386
#673572 [6.0 RC1] Stock move in done state add a pack and production lot
https://bugs.launchpad.net/bugs/673572
#677429 [6.0RC1][purchase]Invoice journal(s) not loaded properly
https://bugs.launchpad.net/bugs/677429
#690228 shouldn't be able to change the company after have vaidated an inventory
https://bugs.launchpad.net/bugs/690228
#690581 Stock_planning : Unable to create Forecasting periods.
https://bugs.launchpad.net/bugs/690581
#690763 PRODUCT V6 : the ean13 check is incorrect
https://bugs.launchpad.net/bugs/690763
Task Id:-1774
BUG:-690228
BUG:-690581
BUG:-690763
--
https://code.launchpad.net/~openerp-dev/openobject-addons/ron-dev-addons2/+merge/44221
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/ron-dev-addons2.
=== modified file 'product/product.py'
--- product/product.py 2010-12-16 04:33:35 +0000
+++ product/product.py 2010-12-20 12:29:56 +0000
@@ -53,7 +53,7 @@
evensum += int(finalean[i])
total=(oddsum * 3) + evensum
- check = int(10 - math.ceil(total % 10.0))
+ check = int(10 - math.ceil(total % 10.0)) %10
if check != int(eancode[-1]):
return False
@@ -523,9 +523,9 @@
if sellers:
for s in sellers:
mydict = {
- 'id': product.id,
- 'name': s.product_name or product.name,
- 'default_code': s.product_code or product.default_code,
+ 'id': product.id,
+ 'name': s.product_name or product.name,
+ 'default_code': s.product_code or product.default_code,
'variants': product.variants
}
result.append(_name_get(mydict))
=== modified file 'purchase/purchase_view.xml'
--- purchase/purchase_view.xml 2010-12-20 11:41:42 +0000
+++ purchase/purchase_view.xml 2010-12-20 12:29:56 +0000
@@ -155,7 +155,7 @@
<field name="state" readonly="1"/>
<button name="purchase_cancel" states="draft,confirmed,wait_auth" string="Cancel" icon="gtk-cancel"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
- <button name="action_cancel" states="approved,except_picking,except_invoice" string="Cancel Purchase Order" type="object" icon="gtk-cancel"/>
+ <button name="action_cancel" states="approved,except_picking,except_invoice,wait" string="Cancel Purchase Order" type="object" icon="gtk-cancel"/>
<button name="picking_ok" states="except_picking" string="Manually Corrected" icon="gtk-convert"/>
<button name="invoice_ok" states="except_invoice" string="Manually Corrected" icon="gtk-convert"/>
<button name="purchase_confirm" states="draft" string="Convert to Purchase Order" icon="gtk-go-forward"/>
=== added directory 'purchase_double_validation'
=== added file 'purchase_double_validation/__init__.py'
--- purchase_double_validation/__init__.py 1970-01-01 00:00:00 +0000
+++ purchase_double_validation/__init__.py 2010-12-20 12:29:56 +0000
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import purchase_double_validation_installer
+
+
=== added file 'purchase_double_validation/__openerp__.py'
--- purchase_double_validation/__openerp__.py 1970-01-01 00:00:00 +0000
+++ purchase_double_validation/__openerp__.py 2010-12-20 12:29:56 +0000
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+{
+ "name" : "purchase_double_validation",
+ "version" : "1.1",
+ "category": 'Generic Modules/Sales & Purchases',
+ "depends" : ["base","purchase"],
+ "author" : "Tiny",
+ "description": """
+ This module modifies purchase workflow in order to validate purchases that exceeds minimum amount set by wizard
+ """,
+ 'author': 'OpenERP SA',
+ 'website': 'http://www.openerp.com',
+
+ 'init_xml': [],
+ 'update_xml': [
+ 'purchase_double_validation_view.xml',
+ 'purchase_double_validation_workflow.xml',
+ 'purchase_double_validation_installer.xml', ],
+ 'demo_xml': [],
+ 'installable': True,
+ 'active': False,
+
+}
=== added file 'purchase_double_validation/purchase_double_validation_installer.py'
--- purchase_double_validation/purchase_double_validation_installer.py 1970-01-01 00:00:00 +0000
+++ purchase_double_validation/purchase_double_validation_installer.py 2010-12-20 12:29:56 +0000
@@ -0,0 +1,55 @@
+#!/usr/bin/python
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+import time
+from osv import fields, osv
+
+class purchase_double_validation_installer(osv.osv_memory):
+ _name = 'purchase.double.validation.installer'
+ _inherit = 'res.config'
+
+ _columns = {
+ 'limit_amount': fields.integer('Limit Amount', required=True, help="Minimum amount after which validation of purchase is required"),
+ }
+
+ _defaults = {
+ 'limit_amount': 1000,
+ }
+
+ def execute(self, cr, uid, ids, context=None):
+ data = self.read(cr, uid, ids, context=context)
+ amt = data[0]['limit_amount']
+ data_pool = self.pool.get('ir.model.data')
+ transition_obj = self.pool.get('workflow.transition')
+ waiting = data_pool._get_id(cr, uid, 'purchase_double_validation', 'trans_router1_waiting')
+ waiting_id = data_pool.browse(cr, uid, waiting, context=context).res_id
+ confirm = data_pool._get_id(cr, uid, 'purchase', 'trans_draft_confirmed')
+ confirm_id = data_pool.browse(cr, uid, confirm, context=context).res_id
+ transition_obj.write(cr, uid, waiting_id, {'condition': 'amount_total>%s' % (amt), 'signal': False})
+ transition_obj.write(cr, uid, confirm_id, {'condition': 'amount_total<=%s' % (amt), 'signal': False})
+ return {}
+
+purchase_double_validation_installer()
+
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'purchase_double_validation/purchase_double_validation_installer.xml'
--- purchase_double_validation/purchase_double_validation_installer.xml 1970-01-01 00:00:00 +0000
+++ purchase_double_validation/purchase_double_validation_installer.xml 2010-12-20 12:29:56 +0000
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <!-- configartion view -->
+
+ <record id="view_config_purchase_limit_amount" model="ir.ui.view">
+ <field name="name">Configure Limit Amount for Purchase</field>
+ <field name="model">purchase.double.validation.installer</field>
+ <field name="type">form</field>
+ <field name="inherit_id" ref="base.res_config_view_base"/>
+ <field name="arch" type="xml">
+ <data>
+ <form position="attributes">
+ <attribute name="string">Purchase Application Configuration</attribute>
+ </form>
+ <separator string="title" position="attributes">
+ <attribute name="string">Configure Limit Amount for Purchase</attribute>
+ </separator>
+ <xpath expr="//label[@string='description']" position="attributes">
+ <attribute name="string">Define minimum amount after which puchase is needed to be validated.</attribute>
+ </xpath>
+ <xpath expr='//separator[@string="vsep"]' position='attributes'>
+ <attribute name='rowspan'>15</attribute>
+ <attribute name='string'></attribute>
+ </xpath>
+ <group string="res_config_contents" position="replace">
+ <field name="limit_amount"/>
+ <newline/>
+ </group>
+ </data>
+ </field>
+ </record>
+
+ <record id="action_config_purchase_limit_amount" model="ir.actions.act_window">
+ <field name="name">Configure Limit Amount for Purchase</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">purchase.double.validation.installer</field>
+ <field name="view_id" ref="view_config_purchase_limit_amount"/>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="target">new</field>
+ </record>
+
+ <!-- register configuration wizard -->
+ <record id="config_wizard_step_purchase_limit_amount" model="ir.actions.todo">
+ <field name="action_id" ref="action_config_purchase_limit_amount"/>
+ <field name="restart">onskip</field>
+ <field name="groups_id" eval="[(6,0,[ref('base.group_extended')])]"/>
+ </record>
+
+ </data>
+</openerp>
=== added file 'purchase_double_validation/purchase_double_validation_view.xml'
--- purchase_double_validation/purchase_double_validation_view.xml 1970-01-01 00:00:00 +0000
+++ purchase_double_validation/purchase_double_validation_view.xml 2010-12-20 12:29:56 +0000
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="view_purchase_form_inherit" model="ir.ui.view">
+ <field name="name">purchase.order.form.inherit</field>
+ <field name="model">purchase.order</field>
+ <field name="inherit_id" ref="purchase.purchase_order_form"/>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <xpath expr="//button[@string='Convert to Purchase Order']" position="replace">
+ <button name="draft_router1" states="draft" string="Confirm" icon="gtk-go-forward"/>
+ </xpath>
+ <xpath expr="//button[@string='Approve Purchase']" position="replace">
+ <button name="waiting_confirmed" states="wait" string="Convert to Purchase Order" icon="gtk-go-forward"/>
+ </xpath>
+ </field>
+ </record>
+
+
+ </data>
+</openerp>
+
=== added file 'purchase_double_validation/purchase_double_validation_workflow.xml'
--- purchase_double_validation/purchase_double_validation_workflow.xml 1970-01-01 00:00:00 +0000
+++ purchase_double_validation/purchase_double_validation_workflow.xml 2010-12-20 12:29:56 +0000
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="act_waiting" model="workflow.activity">
+ <field name="wkf_id" ref="purchase.purchase_order"/>
+ <field name="name">waiting</field>
+ <field name="kind">function</field>
+ <field name="action">write({'state':'wait'})</field>
+ </record>
+
+ <record id="act_router1" model="workflow.activity">
+ <field name="wkf_id" ref="purchase.purchase_order"/>
+ <field name="name">router1</field>
+ <field name="split_mode">OR</field>
+ <field name="kind">dummy</field>
+ </record>
+
+ <record id="trans_draft_router1" model="workflow.transition">
+ <field name="act_from" ref="purchase.act_draft"/>
+ <field name="act_to" ref="act_router1"/>
+ <field name="condition">True</field>
+ <field name="signal">draft_router1</field>
+ </record>
+
+ <record id="trans_router1_waiting" model="workflow.transition">
+ <field name="act_from" ref="act_router1"/>
+ <field name="act_to" ref="act_waiting"/>
+ <field name="condition">True</field>
+ </record>
+
+
+ <record id="purchase.trans_draft_confirmed" model="workflow.transition">
+ <field name="act_from" ref="act_router1"/>
+ <field name="act_to" ref="purchase.act_confirmed"/>
+ <field name="condition">True</field>
+ </record>
+
+ <record id="trans_waiting_confirmed" model="workflow.transition">
+ <field name="act_from" ref="act_waiting"/>
+ <field name="act_to" ref="purchase.act_confirmed"/>
+ <field name="condition">True</field>
+ <field name="signal">waiting_confirmed</field>
+ </record>
+
+ </data>
+</openerp>
\ No newline at end of file
=== modified file 'stock/stock.py'
--- stock/stock.py 2010-12-20 08:22:55 +0000
+++ stock/stock.py 2010-12-20 12:29:56 +0000
@@ -1675,7 +1675,7 @@
result['product_qty'] = product_uos_qty
return {'value': result}
-
+
def onchange_product_id(self, cr, uid, ids, prod_id=False, loc_id=False,
loc_dest_id=False, address_id=False):
""" On change of product id, if finds UoM, UoS, quantity and UoS quantity.
@@ -2445,7 +2445,8 @@
'inventory_line_id': fields.one2many('stock.inventory.line', 'inventory_id', 'Inventories', states={'done': [('readonly', True)]}),
'move_ids': fields.many2many('stock.move', 'stock_inventory_move_rel', 'inventory_id', 'move_id', 'Created Moves'),
'state': fields.selection( (('draft', 'Draft'), ('done', 'Done'), ('confirm','Confirmed'),('cancel','Cancelled')), 'State', readonly=True, select=True),
- 'company_id': fields.many2one('res.company','Company',required=True,select=True),
+ 'company_id': fields.many2one('res.company', 'Company', required=True, select=True, readonly=True, states={'draft':[('readonly',False)]}),
+
}
_defaults = {
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
=== modified file 'stock_planning/stock_planning_view.xml'
--- stock_planning/stock_planning_view.xml 2010-10-25 12:31:24 +0000
+++ stock_planning/stock_planning_view.xml 2010-12-20 12:29:56 +0000
@@ -40,7 +40,7 @@
</tree>
</field>
</record>
-
+
<record id="view_stock_period_search" model="ir.ui.view">
<field name="name">stock.period.search</field>
<field name="model">stock.period</field>
@@ -178,10 +178,10 @@
</graph>
</field>
</record>
-
+
<!-- Forecast section -->
-
- <menuitem id="menu_stock_sale_forecast" name="Sales Forecasts"
+
+ <menuitem id="menu_stock_sale_forecast" name="Sales Forecasts"
parent="base.menu_base_partner" sequence="6" groups="base.group_extended"/>
<record id="view_stock_sale_forecast_filter" model="ir.ui.view">
@@ -224,7 +224,7 @@
action="action_view_stock_sale_forecast_form"/>
<!-- Planning section -->
-
+
<menuitem id="menu_stock_planning_main" name="Stock Planning" parent="stock.menu_stock_root" sequence="2"/>
<record id="view_stock_planning_form" model="ir.ui.view">
@@ -319,6 +319,7 @@
<field name="arch" type="xml">
<tree string="Master Procurement Schedule" colors ="blue:line_time=='Past';black:line_time=='Future'">
<field name="period_id"/>
+ <field name="company_id" invisible="1"/>
<field name="product_id" on_change="product_id_change(product_id)" />
<field name="product_uom"/>
<field name="warehouse_forecast" string="Forecast"/>
=== modified file 'stock_planning/wizard/stock_planning_create_periods.py'
--- stock_planning/wizard/stock_planning_create_periods.py 2010-11-23 07:05:05 +0000
+++ stock_planning/wizard/stock_planning_create_periods.py 2010-12-20 12:29:56 +0000
@@ -21,7 +21,7 @@
import time
from datetime import datetime
-from dateutil.relativedelta import relativedelta
+from dateutil.relativedelta import relativedelta
from osv import osv, fields
@@ -35,7 +35,7 @@
result = cr.fetchone()
last_date = result and result[0] or False
if last_date:
- period_start = datetime(last_date,"%Y-%m-%d %H:%M:%S")+ relativedelta(days=1)
+ period_start = datetime.strptime(last_date,"%Y-%m-%d %H:%M:%S")+ relativedelta(days=1)
period_start = period_start - relativedelta(hours=period_start.hour, minutes=period_start.minute, seconds=period_start.second)
else:
period_start = datetime.today()
@@ -51,7 +51,7 @@
_defaults={
'date_start': _get_new_period_start,
}
-
+
def create_stock_periods(self, cr, uid, ids, context=None):
if context is None:
context = {}
@@ -61,28 +61,51 @@
lines = []
for p in self.browse(cr, uid, ids, context=context):
dt = p.date_start
+ dt_s = p.date_stop
+ dt_stp = datetime.strptime(p.date_stop, '%Y-%m-%d')
ds = datetime.strptime(p.date_start, '%Y-%m-%d')
- while ds.strftime('%Y-%m-%d') < p.date_stop:
+ while ds.strftime('%Y-%m-%d') <= p.date_stop:
if name =='Daily':
- de = ds + relativedelta(days=interval, minutes =-1)
+ de = ds + relativedelta(days=(interval + 1), seconds =-1)
new_name = de.strftime('%Y-%m-%d')
new_id = period_obj.create(cr, uid, {
'name': new_name,
'date_start': ds.strftime('%Y-%m-%d'),
'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'),
})
- ds = ds + relativedelta(days=interval) + 1
+ ds = ds + relativedelta(days=(interval + 1))
if name =="Weekly":
- de = ds + relativedelta(days=interval, minutes =-1)
- new_name = de.strftime('%Y, week %W')
+ de = ds + relativedelta(days=(interval + 1), seconds =-1)
+ if dt_stp < de:
+ de = dt_stp + relativedelta(days=1,seconds =-1)
+ else:
+ de = ds + relativedelta(days=(interval + 1), seconds =-1)
+ start_week = ds.strftime('%W')
+ start_year = ds.strftime('%Y')
+ end_week = de.strftime('%W')
+ end_year = de.strftime('%Y')
+ if start_year <> end_year:
+ if end_week == '00':
+ new_name = "Week " + start_week +"-" + start_year
+ else:
+ new_name = "Week " + start_week +", " + start_year +" - Week " +end_week +", " + end_year
+ elif start_week == end_week:
+ new_name = "Week " + start_week +"-" +start_year
+
+ else:
+ new_name = "Week " + start_week +"-" + end_week+", " + start_year
new_id = period_obj.create(cr, uid, {
'name': new_name,
'date_start': ds.strftime('%Y-%m-%d'),
'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'),
})
- ds = ds + relativedelta(days=interval) + 1
+ ds = ds + relativedelta(days=(interval + 1))
if name == "Monthly":
- de = ds + relativedelta(months=interval, minutes=-1)
+ de = ds + relativedelta(months=interval, seconds=-1)
+ if dt_stp < de:
+ de = dt_stp + relativedelta(days=1,seconds =-1)
+ else:
+ de = ds + relativedelta(months=interval, seconds=-1)
new_name = ds.strftime('%Y/%m')
new_id =period_obj.create(cr, uid, {
'name': new_name,
Follow ups