mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[IMP] - Add failing test for forecast generation of auto renewal contract lines
If a contract line is set to auto renew the forecast should continue after the date end and stop at the company forecast period
This commit is contained in:
@@ -260,3 +260,27 @@ class TestContractLineForecastPeriod(TestContractBase):
|
|||||||
Date.to_date("2020-01-01"),
|
Date.to_date("2020-01-01"),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@mute_logger("odoo.addons.queue_job.models.base")
|
||||||
|
def test_forecast_period_for_auto_renew_contract(self):
|
||||||
|
"""If a contract line is set to auto renew the forecast should continue
|
||||||
|
after the date end and stop at the company forecast period"""
|
||||||
|
# Set the company forecast period to three years
|
||||||
|
self.acct_line.contract_id.company_id.contract_forecast_interval = 36
|
||||||
|
self.acct_line.write(
|
||||||
|
{
|
||||||
|
'date_start': Date.today(),
|
||||||
|
'recurring_next_date': Date.today(),
|
||||||
|
'date_end': Date.today() + relativedelta(years=1),
|
||||||
|
'recurring_rule_type': "monthlylastday",
|
||||||
|
'last_date_invoiced': False,
|
||||||
|
'recurring_invoicing_type': 'pre-paid',
|
||||||
|
'is_auto_renew': False,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
self.assertTrue(self.acct_line.forecast_period_ids)
|
||||||
|
self.assertEqual(len(self.acct_line.forecast_period_ids), 13)
|
||||||
|
|
||||||
|
self.acct_line.write({'is_auto_renew': True})
|
||||||
|
self.assertTrue(self.acct_line.forecast_period_ids)
|
||||||
|
self.assertEqual(len(self.acct_line.forecast_period_ids), 37)
|
||||||
|
|||||||
Reference in New Issue
Block a user