[FIX] When purchase, do not overwrite price

This commit is contained in:
Josse Colpaert 2014-09-05 12:16:09 +02:00
parent 82c5aa6774
commit 1512534320
2 changed files with 5 additions and 4 deletions

View File

@ -91,7 +91,7 @@ class stock_move(osv.osv):
"""
Attribute price to move, important in inter-company moves or receipts with only one partner
"""
if move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal' and not move.price_unit:
if not move.purchase_line_id and move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal' and not move.price_unit:
partner = move.partner_id or (move.picking_id and move.picking_id.partner_id)
price = False
# If partner given, search price in its purchase pricelist
@ -105,7 +105,7 @@ class stock_move(osv.osv):
})[pricelist]
if price:
self.write(cr, uid, [move.id], {'price_unit': price}, context=context)
return True
return True
super(stock_move, self).attribute_price(cr, uid, move, context=context)

View File

@ -2018,8 +2018,9 @@ class stock_move(osv.osv):
"""
Attribute price to move, important in inter-company moves or receipts with only one partner
"""
price = move.product_id.standard_price
self.write(cr, uid, [move.id], {'price_unit': price})
if not move.price_unit:
price = move.product_id.standard_price
self.write(cr, uid, [move.id], {'price_unit': price})
def action_confirm(self, cr, uid, ids, context=None):