[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:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user