From 7958247765b58173c13aa48da5ce886cf8c04d58 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Tue, 22 Feb 2011 15:55:31 +0530 Subject: [PATCH 1/4] [FIX]:stock input account record only a cost price lp bug: https://launchpad.net/bugs/722961 fixed bzr revid: ksa@tinyerp.co.in-20110222102531-1fpz9hvsvx0mftam --- 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 c942818a3d4..b4199335179 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1481,7 +1481,7 @@ class stock_move(osv.osv): 'domain': '[]', 'context': context } - + def name_get(self, cr, uid, ids, context=None): res = [] @@ -2161,7 +2161,7 @@ class stock_move(osv.osv): 'ref': move.picking_id and move.picking_id.name or False, 'date': time.strftime('%Y-%m-%d'), 'partner_id': partner_id, - 'debit': reference_amount, + 'debit': reference_amount * move.product_qty, 'account_id': dest_account_id, } credit_line_vals = { @@ -2171,7 +2171,7 @@ class stock_move(osv.osv): 'ref': move.picking_id and move.picking_id.name or False, 'date': time.strftime('%Y-%m-%d'), 'partner_id': partner_id, - 'credit': reference_amount, + 'credit': reference_amount * move.product_qty, 'account_id': src_account_id, } From fe2d13fc520062691405280dcca9d79650459eb1 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Tue, 22 Feb 2011 17:13:58 +0530 Subject: [PATCH 2/4] [FIX]:stock input account record only a cost price bzr revid: ksa@tinyerp.co.in-20110222114358-vnft4wxroi9ybs3d --- addons/purchase/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index f8f21428540..a279c411565 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -41,7 +41,7 @@ class stock_move(osv.osv): # plug the purchase line values if they are found. if move.purchase_line_id and move.picking_id.purchase_id.pricelist_id: reference_amount, reference_currency_id = move.purchase_line_id.price_unit, move.picking_id.purchase_id.pricelist_id.currency_id.id - return reference_amount, reference_currency_id + return reference_amount * move.product_qty, reference_currency_id stock_move() From ad12d2f19dd2bac47772581421c091480ea6960d Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Tue, 22 Feb 2011 18:25:19 +0530 Subject: [PATCH 3/4] [IMP]: improve wrong commit bzr revid: ksa@tinyerp.co.in-20110222125519-o50p1iewblowh9k8 --- addons/purchase/stock.py | 4 ++-- addons/stock/stock.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index a279c411565..02fbe2d2615 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -40,8 +40,8 @@ class stock_move(osv.osv): # no average price costing or cost not specified during picking validation, we will # plug the purchase line values if they are found. if move.purchase_line_id and move.picking_id.purchase_id.pricelist_id: - reference_amount, reference_currency_id = move.purchase_line_id.price_unit, move.picking_id.purchase_id.pricelist_id.currency_id.id - return reference_amount * move.product_qty, reference_currency_id + reference_amount, reference_currency_id = move.purchase_line_id.price_unit * move.product_qty, move.picking_id.purchase_id.pricelist_id.currency_id.id + return reference_amount , reference_currency_id stock_move() diff --git a/addons/stock/stock.py b/addons/stock/stock.py index b4199335179..6ef49e1fea6 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1463,7 +1463,7 @@ class stock_move(osv.osv): _description = "Stock Move" _order = 'date_expected desc, id' _log_create = False - + def action_partial_move(self, cr, uid, ids, context=None): if context is None: context = {} partial_id = self.pool.get("stock.partial.move").create( @@ -2161,7 +2161,7 @@ class stock_move(osv.osv): 'ref': move.picking_id and move.picking_id.name or False, 'date': time.strftime('%Y-%m-%d'), 'partner_id': partner_id, - 'debit': reference_amount * move.product_qty, + 'debit': reference_amount, 'account_id': dest_account_id, } credit_line_vals = { @@ -2171,7 +2171,7 @@ class stock_move(osv.osv): 'ref': move.picking_id and move.picking_id.name or False, 'date': time.strftime('%Y-%m-%d'), 'partner_id': partner_id, - 'credit': reference_amount * move.product_qty, + 'credit': reference_amount, 'account_id': src_account_id, } From 65590cba9208d35ac8413c6334b9336e357029e7 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Tue, 22 Feb 2011 18:53:45 +0530 Subject: [PATCH 4/4] [IMP]: improve code bzr revid: ksa@tinyerp.co.in-20110222132345-up4ybvm1tgthvk24 --- addons/purchase/stock.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index 02fbe2d2615..e4fe15ef76e 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -35,12 +35,16 @@ class stock_move(osv.osv): on the purchase order in case the valuation data was not directly specified during picking confirmation. """ + product_uom_obj = self.pool.get('product.uom') + reference_amount, reference_currency_id = super(stock_move, self)._get_reference_accounting_values_for_valuation(cr, uid, move, context=context) + default_uom = move.product_id.uom_id.id + qty = product_uom_obj._compute_qty(cr, uid, move.product_uom.id, move.product_qty, default_uom) if move.product_id.cost_method != 'average' or not move.price_unit: # no average price costing or cost not specified during picking validation, we will # plug the purchase line values if they are found. if move.purchase_line_id and move.picking_id.purchase_id.pricelist_id: - reference_amount, reference_currency_id = move.purchase_line_id.price_unit * move.product_qty, move.picking_id.purchase_id.pricelist_id.currency_id.id + reference_amount, reference_currency_id = move.purchase_line_id.price_unit * qty, move.picking_id.purchase_id.pricelist_id.currency_id.id return reference_amount , reference_currency_id stock_move()