mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[FIX] - include date_end in the period if the product is_autorenew
This commit is contained in:
@@ -79,6 +79,7 @@ class SaleOrderLine(models.Model):
|
||||
rec.product_id.auto_renew_rule_type,
|
||||
rec.product_id.auto_renew_interval,
|
||||
)
|
||||
- relativedelta(days=1)
|
||||
)
|
||||
|
||||
@api.onchange('date_start')
|
||||
@@ -88,11 +89,15 @@ class SaleOrderLine(models.Model):
|
||||
if not rec.date_start:
|
||||
rec.date_end = False
|
||||
else:
|
||||
rec.date_end = rec.date_start + self.env[
|
||||
'account.analytic.invoice.line'
|
||||
].get_relative_delta(
|
||||
rec.product_id.auto_renew_rule_type,
|
||||
rec.product_id.auto_renew_interval,
|
||||
rec.date_end = (
|
||||
rec.date_start
|
||||
+ self.env[
|
||||
'account.analytic.invoice.line'
|
||||
].get_relative_delta(
|
||||
rec.product_id.auto_renew_rule_type,
|
||||
rec.product_id.auto_renew_interval,
|
||||
)
|
||||
- relativedelta(days=1)
|
||||
)
|
||||
|
||||
@api.multi
|
||||
|
||||
@@ -129,7 +129,7 @@ class TestSaleOrder(TransactionCase):
|
||||
self.order_line1.recurring_invoicing_type,
|
||||
self.product1.recurring_invoicing_type,
|
||||
)
|
||||
self.assertEqual(self.order_line1.date_end, Date.to_date('2019-01-01'))
|
||||
self.assertEqual(self.order_line1.date_end, Date.to_date('2018-12-31'))
|
||||
|
||||
def test_check_contract_sale_partner(self):
|
||||
"""Can't link order line to a partner contract different then the
|
||||
|
||||
Reference in New Issue
Block a user