From a1fa667be55073b7bbe48a3f2fb5221d687817b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Tue, 12 Aug 2014 12:27:09 +0200 Subject: [PATCH] [IMP] point_of_sale: distinguish discounted lines After closing a POS session, the pos order lines are grouped by product. Instead, distinguish products with a different discount notice to have different lines for such products in the generated account.move for better traceability. --- addons/point_of_sale/point_of_sale.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index eb33e4d30b9..7f785f773a7 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -1073,7 +1073,7 @@ class pos_order(osv.osv): }) if data_type == 'product': - key = ('product', values['partner_id'], values['product_id'], values['debit'] > 0) + key = ('product', values['partner_id'], (values['product_id'], values['name']), values['debit'] > 0) elif data_type == 'tax': key = ('tax', values['partner_id'], values['tax_code_id'], values['debit'] > 0) elif data_type == 'counter_part': @@ -1146,9 +1146,14 @@ class pos_order(osv.osv): if tax_code_id: break + name = line.product_id.name + if line.notice: + # add discount reason in move + name = name + ' (' + line.notice + ')' + # Create a move for the line insert_data('product', { - 'name': line.product_id.name, + 'name': name, 'quantity': line.qty, 'product_id': line.product_id.id, 'account_id': income_account,