From 63bfb6b28d0eec87da7aedf5d656b948f070c67c Mon Sep 17 00:00:00 2001 From: "GPA(OpenERP)" <> Date: Mon, 11 Jan 2010 17:00:46 +0530 Subject: [PATCH] [FIX] Point_Of_Sale : Discount was not linked to the invoice made from returned picking of POS. lp bug: https://launchpad.net/bugs/501386 fixed bzr revid: jvo@tinyerp.com-20100111113046-qg0igbrerhnin815 --- addons/point_of_sale/pos.py | 1 + addons/point_of_sale/stock.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py index b792a374d69..4ad81213301 100644 --- a/addons/point_of_sale/pos.py +++ b/addons/point_of_sale/pos.py @@ -361,6 +361,7 @@ class pos_order(osv.osv): 'product_uos_qty': abs(line.qty), 'product_qty': abs(line.qty), 'tracking_id': False, + 'pos_line_id': line.id, 'state': 'waiting', 'location_id': location_id, 'location_dest_id': stock_dest_id, diff --git a/addons/point_of_sale/stock.py b/addons/point_of_sale/stock.py index 62b49b38c02..fac72107014 100644 --- a/addons/point_of_sale/stock.py +++ b/addons/point_of_sale/stock.py @@ -23,6 +23,17 @@ from osv import osv, fields import time import netsvc +class stock_move(osv.osv): + _inherit = 'stock.move' + + _columns = { + 'pos_line_id': fields.many2one('pos.order.line', + 'Pos Order Line', ondelete='set null', select=True, + readonly=True), + } + +stock_move() + class stock_picking(osv.osv): @@ -30,6 +41,12 @@ class stock_picking(osv.osv): _columns = { 'pos_order': fields.many2one('pos.order', 'Pos order'), } + + def _get_discount_invoice(self, cursor, user, move_line): + if move_line.pos_line_id: + return move_line.pos_line_id.discount + return super(stock_picking, self)._get_discount_invoice(cursor, user, + move_line) stock_picking()