From 6ebcf75dc0ba9b66d27bec1a768033704ca946a6 Mon Sep 17 00:00:00 2001 From: Ahmed Aly Date: Tue, 8 May 2018 11:55:07 +0200 Subject: [PATCH] =?UTF-8?q?Feedback=201648:=20=C3=84ndern=20des=20Rabatt?= =?UTF-8?q?=20in=20ATOC18-000010?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ext/custom-addons/dp_custom/models/sale.py | 1 + ext/custom-addons/dp_sale_hide_discount/models/sale.py | 8 ++++++++ 2 files changed, 9 insertions(+) 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