diff --git a/ext/custom-addons/dp_custom/models/sale.py b/ext/custom-addons/dp_custom/models/sale.py index cc12b979..98bfbfb4 100644 --- a/ext/custom-addons/dp_custom/models/sale.py +++ b/ext/custom-addons/dp_custom/models/sale.py @@ -514,6 +514,7 @@ class SaleOrderLine(models.Model): if discount > 0: vals.update({ 'price_unit': -invoice_lines.price_subtotal * (discount / 100), + 'quantity': 1.0, 'uom_id': self.env.ref('product.product_uom_unit').id, 'name': 'Händlerrabatt {}%'.format(discount), 'hide_intrastat_code': True diff --git a/ext/custom-addons/dp_sale_hide_discount/models/sale.py b/ext/custom-addons/dp_sale_hide_discount/models/sale.py index 0146a9b3..f5a72d13 100644 --- a/ext/custom-addons/dp_sale_hide_discount/models/sale.py +++ b/ext/custom-addons/dp_sale_hide_discount/models/sale.py @@ -68,3 +68,11 @@ class SaleOrderLine(models.Model): line.price_reduce = float_round(line.price_unit * (1.0 - line.discount / 100.0), precision_digits=self.env['decimal.precision'].precision_get( 'Product Price')) + + @api.multi + def _prepare_invoice_line(self, qty): + self.ensure_one() + res = super(SaleOrderLine, self)._prepare_invoice_line(qty) + + res['hide_discount'] = self.hide_discount + return res