[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
This commit is contained in:
Jacky (trj)
2021-08-05 10:34:06 +00:00
parent 6811c374fb
commit 9504f56f9a
+9 -1
View File
@@ -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):