diff --git a/addons/sale/wizard/sale_order_discount.py b/addons/sale/wizard/sale_order_discount.py index e8356554cae..01e264a5f37 100644 --- a/addons/sale/wizard/sale_order_discount.py +++ b/addons/sale/wizard/sale_order_discount.py @@ -63,16 +63,21 @@ class SaleOrderDiscount(models.TransientModel): return vals - def _create_discount_lines(self): - """Create SOline(s) according to wizard configuration""" + def _get_discount_product(self): + """Return product.product used for discount line""" self.ensure_one() - discount_product = self.company_id.sale_discount_product_id if not discount_product: self.company_id.sale_discount_product_id = self.env['product.product'].create( self._prepare_discount_product_values() ) discount_product = self.company_id.sale_discount_product_id + return discount_product + + def _create_discount_lines(self): + """Create SOline(s) according to wizard configuration""" + self.ensure_one() + discount_product = self._get_discount_product() if self.discount_type == 'amount': vals_list = [