[FIX] sale_coupon: Create a discount_line_product_id on program creation

When creating a program, we should always create a discount_line_product_id. Now on a product creation, if a product is not specified, the `vals` dictionary contains `discount_line_product_id: False` and the product is not created. It seems that the behavior on record creation has changed.
This commit is contained in:
Yannick Tivisse
2017-01-17 09:46:49 +01:00
parent 77de506712
commit 034baaa82f
+1 -1
View File
@@ -67,7 +67,7 @@ class SaleCouponProgram(models.Model):
@api.model
def create(self, vals):
program = super(SaleCouponProgram, self).create(vals)
if 'discount_line_product_id' not in vals:
if not vals.get('discount_line_product_id', False):
discount_line_product_id = self.env['product.product'].create({
'name': program.reward_id.name_get()[0][1],
'type': 'service',