|
|
@ -34,6 +34,12 @@ class SaleOrderLine(models.Model): |
|
|
|
string='Invoice Every', |
|
|
|
copy=False, |
|
|
|
) |
|
|
|
recurring_interval = fields.Integer( |
|
|
|
default=1, |
|
|
|
string='Invoice Every', |
|
|
|
help="Invoice every (Days/Week/Month/Year)", |
|
|
|
required=True, |
|
|
|
) |
|
|
|
recurring_invoicing_type = fields.Selection( |
|
|
|
[('pre-paid', 'Pre-paid'), ('post-paid', 'Post-paid')], |
|
|
|
default='pre-paid', |
|
|
@ -75,12 +81,17 @@ class SaleOrderLine(models.Model): |
|
|
|
rec.date_start |
|
|
|
+ contract_line_model.get_relative_delta( |
|
|
|
rec._get_auto_renew_rule_type(), |
|
|
|
int(rec.product_uom_qty), |
|
|
|
int(rec.product_uom_qty*rec.recurring_interval), |
|
|
|
) |
|
|
|
- relativedelta(days=1) |
|
|
|
) |
|
|
|
|
|
|
|
@api.onchange('date_start', 'product_uom_qty', 'recurring_rule_type') |
|
|
|
@api.onchange( |
|
|
|
'date_start', |
|
|
|
'product_uom_qty', |
|
|
|
'recurring_rule_type', |
|
|
|
'recurring_interval' |
|
|
|
) |
|
|
|
def onchange_date_start(self): |
|
|
|
contract_line_model = self.env['contract.line'] |
|
|
|
for rec in self.filtered('product_id.is_contract'): |
|
|
@ -91,7 +102,7 @@ class SaleOrderLine(models.Model): |
|
|
|
rec.date_start |
|
|
|
+ contract_line_model.get_relative_delta( |
|
|
|
rec._get_auto_renew_rule_type(), |
|
|
|
int(rec.product_uom_qty), |
|
|
|
int(rec.product_uom_qty*rec.recurring_interval), |
|
|
|
) |
|
|
|
- relativedelta(days=1) |
|
|
|
) |
|
|
@ -112,7 +123,7 @@ class SaleOrderLine(models.Model): |
|
|
|
self.date_start or fields.Date.today(), |
|
|
|
self.recurring_invoicing_type, |
|
|
|
self.recurring_rule_type, |
|
|
|
1, |
|
|
|
self.recurring_interval, |
|
|
|
) |
|
|
|
termination_notice_interval = ( |
|
|
|
self.product_id.termination_notice_interval |
|
|
@ -143,7 +154,7 @@ class SaleOrderLine(models.Model): |
|
|
|
'date_end': self.date_end, |
|
|
|
'date_start': self.date_start or fields.Date.today(), |
|
|
|
'recurring_next_date': recurring_next_date, |
|
|
|
'recurring_interval': 1, |
|
|
|
'recurring_interval': self.recurring_interval, |
|
|
|
'recurring_invoicing_type': self.recurring_invoicing_type, |
|
|
|
'recurring_rule_type': self.recurring_rule_type, |
|
|
|
'is_auto_renew': self.product_id.is_auto_renew, |
|
|
|