From b541187345cfd6888a416cad795b9c0f0b65b26c Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Mon, 17 Aug 2015 16:40:49 +0200 Subject: [PATCH 1/2] [FIX] l10n_ca: no attempt to re-create input/output accounts properties Deleting the properties for the default accounts in the root product category and then updating the l10n_ca module leaded to a crash due to the fact the module tried to re-create the properties as they were no longer there. Fixes #3130 Closes #3131 --- addons/l10n_ca/account_chart_template_en.xml | 22 +++++++++++--------- addons/l10n_ca/account_chart_template_fr.xml | 22 +++++++++++--------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/addons/l10n_ca/account_chart_template_en.xml b/addons/l10n_ca/account_chart_template_en.xml index c0deebfce6b..ed28df2fb53 100644 --- a/addons/l10n_ca/account_chart_template_en.xml +++ b/addons/l10n_ca/account_chart_template_en.xml @@ -1,5 +1,17 @@ + + + + + + + + + + + + @@ -22,16 +34,6 @@ - - - - - - - - - - property_stock_valuation_account_id diff --git a/addons/l10n_ca/account_chart_template_fr.xml b/addons/l10n_ca/account_chart_template_fr.xml index 71b1eb8ba32..d9d24a06d69 100644 --- a/addons/l10n_ca/account_chart_template_fr.xml +++ b/addons/l10n_ca/account_chart_template_fr.xml @@ -1,5 +1,17 @@ + + + + + + + + + + + + @@ -22,16 +34,6 @@ - - - - - - - - - - property_stock_valuation_account_id From 607114ff00576380c45a5b7a2c1391ee914c7238 Mon Sep 17 00:00:00 2001 From: Laetitia Gangloff Date: Mon, 17 Aug 2015 17:59:47 +0200 Subject: [PATCH 2/2] [FIX] stock: Scheduled / Max. Expected date change on picking when changed in its moves When changing the min_date / max_date in a move, the date change wasn't propagated to its picking. The use of store triggers is needed in such a case, `store=True` isn't enough Fixes #1862 Closes #3278 --- addons/stock/stock.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index c234a951b1c..276e24b4e2d 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -630,6 +630,13 @@ class stock_picking(osv.osv): res[pick]['max_date'] = dt2 return res + def _get_pickings(self, cr, uid, ids, context=None): + res = set() + for move in self.browse(cr, uid, ids, context=context): + if move.picking_id and not move.picking_id.min_date < move.date_expected < move.picking_id.max_date: + res.add(move.picking_id.id) + return list(res) + def create(self, cr, user, vals, context=None): if ('name' not in vals) or (vals.get('name')=='/'): seq_obj_name = self._name @@ -665,11 +672,11 @@ class stock_picking(osv.osv): * Cancelled: has been cancelled, can't be confirmed anymore""" ), 'min_date': fields.function(get_min_max_date, fnct_inv=_set_minimum_date, multi="min_max_date", - store=True, type='datetime', string='Scheduled Time', select=1, help="Scheduled time for the shipment to be processed"), + store={'stock.move': (_get_pickings, ['date_expected', 'picking_id'], 20)}, type='datetime', string='Scheduled Time', select=1, help="Scheduled time for the shipment to be processed"), 'date': fields.datetime('Creation Date', help="Creation date, usually the time of the order.", select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}), 'date_done': fields.datetime('Date of Transfer', help="Date of Completion", states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}), 'max_date': fields.function(get_min_max_date, fnct_inv=_set_maximum_date, multi="min_max_date", - store=True, type='datetime', string='Max. Expected Date', select=2), + store={'stock.move': (_get_pickings, ['date_expected', 'picking_id'], 20)}, type='datetime', string='Max. Expected Date', select=2), 'move_lines': fields.one2many('stock.move', 'picking_id', 'Internal Moves', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}), 'product_id': fields.related('move_lines', 'product_id', type='many2one', relation='product.product', string='Product'), 'auto_picking': fields.boolean('Auto-Picking', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),