From 9504f56f9aa5879f2196f750d80eeaf0ff32a7cd Mon Sep 17 00:00:00 2001 From: "Jacky (trj)" Date: Tue, 15 Jun 2021 09:04:15 +0000 Subject: [PATCH] [FIX] point_of_sale: show discount information from pricelist in invoice When the discount policy of a pricelist was set to `without_discount`, the discount information was shown in the order line of the product screen and on the receipt but not in the invoice. task-2492631 --- addons/point_of_sale/models/pos_order.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index df754628195..4a6f4b5528a 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -9,7 +9,7 @@ import pytz import re from odoo import api, fields, models, tools, _ -from odoo.tools import float_is_zero, float_round +from odoo.tools import float_is_zero, float_round, float_repr from odoo.exceptions import ValidationError, UserError from odoo.http import request from odoo.osv.expression import AND @@ -202,12 +202,20 @@ class PosOrder(models.Model): invoice_lines = [] for line in self.lines: invoice_lines.append((0, None, self._prepare_invoice_line(line))) + if line.order_id.pricelist_id.discount_policy == 'without_discount' and line.price_unit != line.product_id.lst_price: + invoice_lines.append((0, None, { + 'name': _('Price discount from %s -> %s', + float_repr(line.product_id.lst_price, self.currency_id.decimal_places), + float_repr(line.price_unit, self.currency_id.decimal_places)), + 'display_type': 'line_note', + })) if line.customer_note: invoice_lines.append((0, None, { 'name': line.customer_note, 'display_type': 'line_note', })) + return invoice_lines def _get_pos_anglo_saxon_price_unit(self, product, partner_id, quantity):