From 019ecefa51d04d0c138858d92f407e0eaa228255 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Tue, 14 Apr 2020 11:25:09 +0200 Subject: [PATCH] [IMP] - Contract: add new recurring_rule_type quarterly and semesterly --- contract/models/abstract_contract_line.py | 2 ++ contract/models/contract_line.py | 4 ++++ product_contract/models/product_template.py | 2 ++ product_contract/models/sale_order_line.py | 2 ++ 4 files changed, 10 insertions(+) diff --git a/contract/models/abstract_contract_line.py b/contract/models/abstract_contract_line.py index a1ed154dc..a7c603367 100644 --- a/contract/models/abstract_contract_line.py +++ b/contract/models/abstract_contract_line.py @@ -59,6 +59,8 @@ class ContractAbstractContractLine(models.AbstractModel): ('weekly', 'Week(s)'), ('monthly', 'Month(s)'), ('monthlylastday', 'Month(s) last day'), + ('quarterly', 'Quarter(s)'), + ('semesterly', 'Semester(s)'), ('yearly', 'Year(s)'), ], default='monthly', diff --git a/contract/models/contract_line.py b/contract/models/contract_line.py index e5074d654..d67447965 100644 --- a/contract/models/contract_line.py +++ b/contract/models/contract_line.py @@ -799,6 +799,10 @@ class ContractLine(models.Model): return relativedelta(months=interval) elif recurring_rule_type == 'monthlylastday': return relativedelta(months=interval, day=1) + elif recurring_rule_type == 'quarterly': + return relativedelta(months=3 * interval) + elif recurring_rule_type == 'semesterly': + return relativedelta(months=6 * interval) else: return relativedelta(years=interval) diff --git a/product_contract/models/product_template.py b/product_contract/models/product_template.py index 3ce6bdc44..0e784d993 100644 --- a/product_contract/models/product_template.py +++ b/product_contract/models/product_template.py @@ -22,6 +22,8 @@ class ProductTemplate(models.Model): ('weekly', 'Week(s)'), ('monthly', 'Month(s)'), ('monthlylastday', 'Month(s) last day'), + ('quarterly', 'Quarter(s)'), + ('semesterly', 'Semester(s)'), ('yearly', 'Year(s)'), ], default='monthly', diff --git a/product_contract/models/sale_order_line.py b/product_contract/models/sale_order_line.py index bcaf1cef8..4883306db 100644 --- a/product_contract/models/sale_order_line.py +++ b/product_contract/models/sale_order_line.py @@ -27,6 +27,8 @@ class SaleOrderLine(models.Model): ('weekly', 'Week(s)'), ('monthly', 'Month(s)'), ('monthlylastday', 'Month(s) last day'), + ('quarterly', 'Quarter(s)'), + ('semesterly', 'Semester(s)'), ('yearly', 'Year(s)'), ], default='monthly',