[FIX] stock, stock_account: update of product cost price

bzr revid: qdp-launchpad@openerp.com-20130924082804-654jv5dkywfooivu
This commit is contained in:
Quentin (OpenERP) 2013-09-24 10:28:04 +02:00
parent f49e0dd3b2
commit 856b4a284e
2 changed files with 4 additions and 3 deletions

View File

@ -375,10 +375,11 @@ class stock_quant(osv.osv):
remaining_to_solve_quant_ids = self.search(cr, uid, [('propagated_from_id', '=', quant_neg.id), ('id', 'not in', solved_quant_ids)], context=context)
if remaining_to_solve_quant_ids:
self.write(cr, uid, remaining_to_solve_quant_ids, {'propagated_from_id': remaining_neg_quant.id}, context=context)
#price update + accounting entries adjustments
self._price_update(cr, uid, solved_quant_ids, solving_quant.cost, context=context)
quant_cost = solving_quant.cost
#delete the reconciled quants, as it is replaced by the solving quant
self.unlink(cr, SUPERUSER_ID, [quant_neg.id, solving_quant.id], context=context)
#price update + accounting entries adjustments
self._price_update(cr, uid, solved_quant_ids, quant_cost, context=context)
solving_quant = remaining_solving_quant
#solving_quant, dummy = self._reconcile_single_negative_quant(cr, uid, to_solve_quant, solving_quant, quant_neg, qty, context=context)

View File

@ -62,6 +62,7 @@ class stock_quant(osv.osv):
def _price_update(self, cr, uid, quant_ids, newprice, context=None):
if context is None:
context = {}
super(stock_quant, self)._price_update(cr, uid, quant_ids, newprice, context=context)
ctx = context.copy()
for quant in self.browse(cr, uid, quant_ids, context=context):
move = self._get_latest_move(cr, uid, quant, context=context)
@ -73,7 +74,6 @@ class stock_quant(osv.osv):
#2) we just fixed a negative quant caused by an outgoing shipment
if quant.product_id.cost_method == 'real' and quant.location_id.usage != 'internal':
self.pool.get('stock.move')._store_average_cost_price(cr, uid, move, context=context)
super(stock_quant, self)._price_update(cr, uid, quant_ids, newprice, context=context)
"""
Accounting Valuation Entries