From 61a8971db510dbb0e087bba09858fe8b94c7b16d Mon Sep 17 00:00:00 2001 From: Julien Legros Date: Tue, 4 Nov 2014 18:07:59 +0100 Subject: [PATCH 1/2] [FIX] mrp: chain product move and MO locations When validating a SO containing a `make to stock` + `manufacture` product (with bom + orderpoint), we have the following stock moves: * Product move * Manufacturing order Selling 1 such product would yield 2 as incoming quantity, an inconsistency that this commit solves by setting the location_id of the product move to the MO's location_dest_id (in the same fashion that the create_pickings method does in an mts/buy case) opw-616229 --- addons/mrp/mrp.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index e8e1887caf8..72226e9de60 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -993,6 +993,8 @@ class mrp_production(osv.osv): 'state': 'waiting', 'company_id': production.company_id.id, } + if production.move_prod_id: + production.move_prod_id.write({'location_id': destination_location_id}) move_id = stock_move.create(cr, uid, data, context=context) production.write({'move_created_ids': [(6, 0, [move_id])]}, context=context) return move_id From cd69dee3f2c7a69ca2732688e1a0989473479711 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 5 Nov 2014 13:36:20 +0100 Subject: [PATCH 2/2] [FIX] web: inhibit on change flag when validating editable list To valid all editable list line, we iterate on the lines and set the editor form with the line value, using set_value. The _inhibit_on_change_flag should be set to True to avoid triggering on changes events opw-617395 --- addons/web/static/src/js/view_form.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index f4dd7ec501f..cfada94c4e7 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3890,7 +3890,9 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ return _.every(this.records.records, function(record){ r = record; _.each(self.editor.form.fields, function(field){ + field._inhibit_on_change_flag = true; field.set_value(r.attributes[field.name]); + field._inhibit_on_change_flag = false; }); return _.every(self.editor.form.fields, function(field){ field.process_modifiers();