From 2fa050b3aed37701f7a0cff52dcb7e991b11435e Mon Sep 17 00:00:00 2001
From: Nicolas Martinelli <nim@odoo.com>
Date: Fri, 6 Dec 2019 09:00:15 +0000
Subject: [PATCH] [FIX] sale_coupon: expiration date

MAke sure to always set the expiration date of a coupon.

opw-2151284

closes odoo/odoo#41470

X-original-commit: 2e5a66995f2488b99ed1c6d8407235f4fc032e66
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
---
 addons/sale_coupon/models/sale_coupon.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/addons/sale_coupon/models/sale_coupon.py b/addons/sale_coupon/models/sale_coupon.py
index 522ce8362a22..934c1367e2f8 100644
--- a/addons/sale_coupon/models/sale_coupon.py
+++ b/addons/sale_coupon/models/sale_coupon.py
@@ -46,6 +46,7 @@ class SaleCoupon(models.Model):
     ]
 
     def _compute_expiration_date(self):
+        self.expiration_date = 0
         for coupon in self.filtered(lambda x: x.program_id.validity_duration > 0):
             coupon.expiration_date = (coupon.create_date + relativedelta(days=coupon.program_id.validity_duration)).date()
 
-- 
GitLab