[FIX] loyalty: include date_to in program's validity

closes odoo/odoo#100339

Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
This commit is contained in:
William Braeckman
2022-09-16 14:25:53 +02:00
parent 84a384e812
commit 3ed96f292e
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ class PosConfig(models.Model):
}
check_date = fields.Date.from_string(creation_date[:11])
if (coupon.expiration_date and coupon.expiration_date < check_date) or\
(coupon.program_id.date_to and coupon.program_id.date_to <= fields.Date.context_today(self)) or\
(coupon.program_id.date_to and coupon.program_id.date_to < fields.Date.context_today(self)) or\
(coupon.program_id.limit_usage and coupon.program_id.total_order_count >= coupon.program_id.max_usage):
return {
'successful': False,
+1 -1
View File
@@ -956,7 +956,7 @@ class SaleOrder(models.Model):
if not program or not program.active:
return {'error': _('This code is invalid (%s).', code), 'not_found': True}
elif (program.limit_usage and program.total_order_count >= program.max_usage) or\
(program.date_to and program.date_to <= fields.Date.context_today(self)):
(program.date_to and program.date_to < fields.Date.context_today(self)):
return {'error': _('This code is expired (%s).', code)}
# Rule will count the next time the points are updated