From 602c38bcc28f4496f95706468234277552c8fda4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Sun, 28 Feb 2010 00:18:01 -0300 Subject: [PATCH] [REF] backward compatible refactoring introducing an extension point in inventory line to move line creation. Useful for instance for double unit management of inventory extension module. Removed TOPO comment regarding need for tracking in inventory as it seems to work like a charm bzr revid: rvalyi@gmail.com-20100228031801-171hrv4yq9anu9n9 --- addons/stock/stock.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 240bc9762ce..b6b98316805 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1585,10 +1585,12 @@ class stock_inventory(osv.osv): 'state': lambda *a: 'draft', 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c) } + + + def _inventory_line_hook(self, cr, uid, inventory_line, move_vals): + '''Creates a stock move from an inventory line''' + return self.pool.get('stock.move').create(cr, uid, move_vals) - # - # Update to support tracking - # def action_done(self, cr, uid, ids, context=None): for inv in self.browse(cr, uid, ids): move_ids = [] @@ -1628,7 +1630,7 @@ class stock_inventory(osv.osv): 'prodlot_id': lot_id, 'product_qty': line.product_qty }) - move_ids.append(self.pool.get('stock.move').create(cr, uid, value)) + move_ids.append(self._inventory_line_hook(cr, uid, line, value)) if len(move_ids): self.pool.get('stock.move').action_done(cr, uid, move_ids, context=context)