From 25c9549d31ca435cb5b44eccc9c9029ab70c843f Mon Sep 17 00:00:00 2001 From: "Purnendu Singh (OpenERP)" Date: Mon, 14 Oct 2013 18:40:52 +0530 Subject: [PATCH 01/13] [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 02/13] [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 03/13] [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 04/13] [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 _ From af84a5dbb5c6d018f58443f655f92349e18cc79b Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 14 Oct 2013 17:22:02 +0200 Subject: [PATCH 05/13] [FIX] stock_locations: access rights bzr revid: qdp-launchpad@openerp.com-20131014152202-3202f74h8p45b9y5 --- addons/stock_location/security/ir.model.access.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/stock_location/security/ir.model.access.csv b/addons/stock_location/security/ir.model.access.csv index e26ded0edab..6339ccf579a 100644 --- a/addons/stock_location/security/ir.model.access.csv +++ b/addons/stock_location/security/ir.model.access.csv @@ -11,4 +11,5 @@ access_stock_location_path,stock.location.path,model_stock_location_path,base.gr access_procurement_rule,procurement.rule.flow,model_procurement_rule,base.group_sale_salesman,1,0,0,0 access_procurement_rule_internal,procurement.rule.flow internal,model_procurement_rule,base.group_user,1,0,0,0 access_stock_putaway_all,stock.putaway all users,model_stock_move_putaway,base.group_user,1,0,0,0 +access_product_putaway_all,product.putaway all users,model_product_putaway,base.group_user,1,0,0,0 access_stock_removal_all,product.removal all users,model_product_removal,base.group_user,1,0,0,0 From 93c4d0eae10ee968b15682ec781d544e684682cb Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 14 Oct 2013 17:38:22 +0200 Subject: [PATCH 06/13] [FIX] stock:typo bzr revid: qdp-launchpad@openerp.com-20131014153822-tkmx0jlprx60gin6 --- addons/stock/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 0b215c6f6af..783f274803a 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -397,7 +397,7 @@ class stock_quant(osv.osv): #solving_quant, dummy = self._reconcile_single_negative_quant(cr, uid, to_solve_quant, solving_quant, quant_neg, qty, context=context) def _price_update(self, cr, uid, ids, newprice, context=None): - self.write(cr, SUPERSER_ID, ids, {'cost': newprice}, context=context) + self.write(cr, SUPERUSER_ID, ids, {'cost': newprice}, context=context) def write(self, cr, uid, ids, vals, context=None): #We want to trigger the move with nothing on reserved_quant_ids for the store of the remaining quantity From bf89cee4fe968bdc4a8a34a334f4007df94d1932 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Tue, 15 Oct 2013 11:28:17 +0200 Subject: [PATCH 07/13] [FIX] stock: usability improvements and bug fixed at the picking creatino time when no scheduled_date is given bzr revid: qdp-launchpad@openerp.com-20131015092817-z4ss9yhjdz1z2kge --- addons/stock/stock.py | 5 ++- addons/stock/stock_view.xml | 76 ++++++++++++++++++++----------------- 2 files changed, 44 insertions(+), 37 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 783f274803a..f74e55d3af7 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -481,8 +481,9 @@ class stock_picking(osv.osv): def _set_min_date(self, cr, uid, id, field, value, arg, context=None): move_obj = self.pool.get("stock.move") - move_ids = [move.id for move in self.browse(cr, uid, id, context=context).move_lines] - move_obj.write(cr, uid, move_ids, {'date_expected': value}, context=context) + if value: + move_ids = [move.id for move in self.browse(cr, uid, id, context=context).move_lines] + move_obj.write(cr, uid, move_ids, {'date_expected': value}, context=context) def get_min_max_date(self, cr, uid, ids, field_name, arg, context=None): """ Finds minimum and maximum dates for picking. diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index ae5b50e288f..3e4ab8bcc1c 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -591,7 +591,6 @@