mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[FIX] - fix stop_plan_successor case 5
contract line start in the suspension period and end after it
This commit is contained in:
@@ -557,7 +557,7 @@ class AccountAnalyticInvoiceLine(models.Model):
|
||||
- suspension.date_start)
|
||||
* contract line start and end's in the suspension period
|
||||
-> apply delay
|
||||
- delay: suspension.date_end - contract_line.end_date
|
||||
- delay: suspension.date_end - contract_line.date_start
|
||||
* contract line start in the suspension period and end after it
|
||||
-> apply delay
|
||||
- delay: suspension.date_end - contract_line.date_start
|
||||
@@ -576,13 +576,7 @@ class AccountAnalyticInvoiceLine(models.Model):
|
||||
contract_line = self.env['account.analytic.invoice.line']
|
||||
for rec in self:
|
||||
if rec.date_start >= date_start:
|
||||
if rec.date_end and rec.date_end <= date_end:
|
||||
delay = date_end - rec.date_end
|
||||
elif (
|
||||
rec.date_end
|
||||
and rec.date_end > date_end
|
||||
or not rec.date_end
|
||||
) and rec.date_start <= date_end:
|
||||
if rec.date_start < date_end:
|
||||
delay = date_end - rec.date_start
|
||||
else:
|
||||
delay = date_end - date_start
|
||||
|
||||
@@ -827,10 +827,11 @@ class TestContract(TestContractBase):
|
||||
suspension_start, suspension_end, True
|
||||
)
|
||||
self.assertEqual(
|
||||
self.acct_line.date_start, start_date + (suspension_end - end_date)
|
||||
self.acct_line.date_start,
|
||||
start_date + (suspension_end - start_date),
|
||||
)
|
||||
self.assertEqual(
|
||||
self.acct_line.date_end, end_date + (suspension_end - end_date)
|
||||
self.acct_line.date_end, end_date + (suspension_end - start_date)
|
||||
)
|
||||
new_line = self.env['account.analytic.invoice.line'].search(
|
||||
[('predecessor_contract_line_id', '=', self.acct_line.id)]
|
||||
|
||||
Reference in New Issue
Block a user