From 1e8f7923f17110999f414db6a772864ac0881063 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 27 Jun 2013 12:42:55 +0200 Subject: [PATCH 1/2] [IMP] stock: WIP packaging bzr revid: qdp-launchpad@openerp.com-20130627104255-gwhfgmbo41whphht --- addons/stock/stock.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 1e0fe2d4b75..c89ae8c50e7 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1601,11 +1601,19 @@ class stock_picking(osv.osv): 'stock', self._VIEW_LIST.get(type, 'view_picking_form')) return res and res[1] or False + def _get_picking_for_packing_ui(self, cr, uid, context=None): + return self.search(cr, uid, [('state', '=', 'assigned')], limit=1, context=context)[0] + def action_done_from_packing_ui(self, cr, uid, picking_id, context=None): #fill all the packages with assigned operations - #call action_done of picking + for operation in self.browse(cr, uid, picking_id, context=context).pack_operation_ids: + #pack existing packs + if operation.package_id and operation.result_package_id: + self.pool.get('stock.quant.package').write(cr, uid, operation.package_id.id, {'parent_id': operation.result_package_id.id}, context=context) + #don't call action_done of picking because it will make all moves don, but make a partial delivery + #self.action_done(cr, uid, picking_id, context=context) #return id of next picking to work on - pass + return self._get_picking_for_packing_ui(cr, uid, context=context) def action_pack(self, cr, uid, picking_id, context=None): stock_operation_obj = self.pool.get('stock.pack.operation') From 0c9db183b6f27f06d5b4317815187bfc20fdab56 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 27 Jun 2013 14:31:08 +0200 Subject: [PATCH 2/2] [IMP] stock: WIP packaging bzr revid: qdp-launchpad@openerp.com-20130627123108-x5c22db6ao6sl74s --- addons/stock/stock.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index c89ae8c50e7..b4e54f2ec22 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1610,6 +1610,9 @@ class stock_picking(osv.osv): #pack existing packs if operation.package_id and operation.result_package_id: self.pool.get('stock.quant.package').write(cr, uid, operation.package_id.id, {'parent_id': operation.result_package_id.id}, context=context) + if operation.result_package_id: + if operation.package_id: + pass #don't call action_done of picking because it will make all moves don, but make a partial delivery #self.action_done(cr, uid, picking_id, context=context) #return id of next picking to work on @@ -1644,6 +1647,8 @@ class stock_picking(osv.osv): product_obj = self.pool.get('product.product') stock_operation_obj = self.pool.get('stock.pack.operation') error_msg = '' + todo_on_moves = [] + todo_on_operations = [] #check if the barcode correspond to a product matching_product_ids = product_obj.search(cr, uid, ['|', ('code', '=', barcode_str), ('ean13', '=', barcode_str)], context=context)