From 25c9549d31ca435cb5b44eccc9c9029ab70c843f Mon Sep 17 00:00:00 2001 From: "Purnendu Singh (OpenERP)" Date: Mon, 14 Oct 2013 18:40:52 +0530 Subject: [PATCH 1/4] [FIX] yml fix, need to update the system as it's not working in case of only service type of product in bom bzr revid: psi@tinyerp.com-20131014131052-sil5acy3yez0f7gq --- .../mrp/test/bom_with_service_type_product.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/addons/mrp/test/bom_with_service_type_product.yml b/addons/mrp/test/bom_with_service_type_product.yml index dc434cabf73..550ab660679 100644 --- a/addons/mrp/test/bom_with_service_type_product.yml +++ b/addons/mrp/test/bom_with_service_type_product.yml @@ -20,7 +20,7 @@ I make the production order using BoM having one service type product and one consumable product. - !record {model: mrp.production, id: mrp_production_servicetype_mo1}: - product_id: product.product_product_5 + product_id: product.product_product_3 product_qty: 1.0 bom_id: mrp_bom_test1 date_planned: !eval time.strftime('%Y-%m-%d %H:%M:%S') @@ -36,21 +36,13 @@ - !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_servicetype_mo1} - - I confirm the Consume Products. + I reserved the product. - !python {model: mrp.production}: | order = self.browse(cr, uid, ref("mrp_production_servicetype_mo1")) assert order.state == 'confirmed', "Production order should be confirmed." - for move_line in order.move_lines: - move_line.action_consume(move_line.product_qty) -- - I processed the Product Entirely. -- - !python {model: mrp.production}: | - order = self.browse(cr, uid, ref("mrp_production_servicetype_mo1")) - assert order.state == 'in_production', 'Production order should be in production State.' - for move_created in order.move_created_ids: - move_created.action_done() + self.force_production(cr, uid, [order.id]) + - I produce product. - @@ -90,7 +82,7 @@ I make the production order using BoM having two service type products. - !record {model: mrp.production, id: mrp_production_servicetype_2}: - product_id: product.product_product_5 + product_id: product.product_product_3 product_qty: 1.0 bom_id: mrp_bom_test_2 date_planned: !eval time.strftime('%Y-%m-%d %H:%M:%S') From d74a5ff57e9b394c9bbc60ab44fff6811f860412 Mon Sep 17 00:00:00 2001 From: "Purnendu Singh (OpenERP)" Date: Mon, 14 Oct 2013 19:13:56 +0530 Subject: [PATCH 2/4] [FIX] stock: use SUPERUSER_ID to create/copy quants bzr revid: psi@tinyerp.com-20131014134356-hm7cxryjnbgs2j14 --- addons/stock/stock.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 9888092f708..a20f392c7fa 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -840,8 +840,8 @@ class stock_picking(osv.osv): for picking in self.browse(cr, uid, picking_ids, context=context): for move in picking.move_lines: ids_to_free += [quant.id for quant in move.reserved_quant_ids] - if ids_to_free: - quant_obj.write(cr, uid, ids_to_free, {'reservation_id' : False, 'reservation_op_id': False }, context = context) + if ids_to_free: + quant_obj.write(cr, SUPERUSER_ID, ids_to_free, {'reservation_id' : False, 'reservation_op_id': False }, context = context) def _reserve_quants_ops_move(self, cr, uid, ops, move, qty, create=False, context=None): """ @@ -867,7 +867,7 @@ class stock_picking(osv.osv): if quant[0]: #If quant can be reserved res_qty -= quant[1] quant_obj.quants_reserve(cr, uid, quants, move, context=context) - quant_obj.write(cr, uid, [x[0].id for x in quants if x[0]], {'reservation_op_id': ops.id}, context=context) + quant_obj.write(cr, SUPERUSER_ID, [x[0].id for x in quants if x[0]], {'reservation_op_id': ops.id}, context=context) return res_qty From e835e6a02b7dd6bbd7b555f4cb0a9625831b4e83 Mon Sep 17 00:00:00 2001 From: "Purnendu Singh (OpenERP)" Date: Mon, 14 Oct 2013 19:19:29 +0530 Subject: [PATCH 3/4] [FIX] stock: use SUPERUSER_ID to create/copy move.putaway bzr revid: psi@tinyerp.com-20131014134929-guotecza5stzrhyw --- addons/stock_location/stock_location.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock_location/stock_location.py b/addons/stock_location/stock_location.py index 0a7df282f55..04ab9a99400 100644 --- a/addons/stock_location/stock_location.py +++ b/addons/stock_location/stock_location.py @@ -823,7 +823,7 @@ class stock_move(osv.osv): # Should call different methods here in later versions # TODO: take care of lots if putaway.method == 'fixed' and putaway.location_spec_id: - moveputaway_obj.create(cr, uid, {'move_id': move.id, + moveputaway_obj.create(cr, SUPERUSER_ID, {'move_id': move.id, 'location_id': putaway.location_spec_id.id, 'quantity': move.product_uom_qty}, context=context) return True From 2a3f9e2fd93cfed203022ce8a7c39cc73a8d6739 Mon Sep 17 00:00:00 2001 From: "Purnendu Singh (OpenERP)" Date: Mon, 14 Oct 2013 19:22:47 +0530 Subject: [PATCH 4/4] [MISC] bzr revid: psi@tinyerp.com-20131014135247-ik597wypqph67bhk --- addons/stock_location/stock_location.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/stock_location/stock_location.py b/addons/stock_location/stock_location.py index 04ab9a99400..4cd932773d7 100644 --- a/addons/stock_location/stock_location.py +++ b/addons/stock_location/stock_location.py @@ -20,6 +20,7 @@ ############################################################################## from openerp.osv import fields, osv +from openerp import SUPERUSER_ID from datetime import * from dateutil.relativedelta import relativedelta from openerp.tools.translate import _