From 5ddf27083cd86792c76be63d171ab5843e8bb17b Mon Sep 17 00:00:00 2001
From: "rha@tinyerp.com" <>
Date: Wed, 29 Dec 2010 18:44:20 +0530
Subject: [PATCH] [Fix]: Bug #613286 [stock]: returned products from customers
have cost price of the day instead of historical cost price
bzr revid: rha@tinyerp.com-20101229131420-k97xl7mrx9htvchi
---
addons/sale/sale.py | 1 +
addons/stock/stock.py | 3 +++
addons/stock/stock_view.xml | 2 ++
addons/stock/wizard/stock_return_picking.py | 20 +++++++++++++++-----
4 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index a789ad287f3..aba732797ef 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -702,6 +702,7 @@ class sale_order(osv.osv):
#'state': 'waiting',
'note': line.notes,
'company_id': order.company_id.id,
+ 'returned_price': line.price_unit,
})
if line.product_id:
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 0c0e21fa2b9..66f295c54e0 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -1212,6 +1212,8 @@ class stock_picking(osv.osv):
{'price_unit': product_price,
'price_currency_id': product_currency})
+ if not move.returned_price:
+ move_obj.write(cr, uid, [move.id], {'returned_price': move.price_unit})
for move in too_few:
product_qty = move_product_qty[move.id]
@@ -1532,6 +1534,7 @@ class stock_move(osv.osv):
# used for colors in tree views:
'scrapped': fields.related('location_dest_id','scrap_location',type='boolean',relation='stock.location',string='Scrapped', readonly=True),
+ 'returned_price': fields.float('Returned product price', digits=(16,2)),
}
_constraints = [
(_check_tracking,
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index 0c99a6cf272..54aacc4ac94 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -672,6 +672,7 @@
+
+