mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[12.0][FIX] - raise an error when next invoice date before the last date invoiced
This commit is contained in:
@@ -569,7 +569,9 @@ class ContractLine(models.Model):
|
|||||||
% line.name
|
% line.name
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.constrains('date_start', 'date_end', 'last_date_invoiced')
|
@api.constrains(
|
||||||
|
'date_start', 'date_end', 'last_date_invoiced', 'recurring_next_date'
|
||||||
|
)
|
||||||
def _check_last_date_invoiced(self):
|
def _check_last_date_invoiced(self):
|
||||||
for rec in self.filtered('last_date_invoiced'):
|
for rec in self.filtered('last_date_invoiced'):
|
||||||
if rec.date_start and rec.date_start > rec.last_date_invoiced:
|
if rec.date_start and rec.date_start > rec.last_date_invoiced:
|
||||||
@@ -588,6 +590,17 @@ class ContractLine(models.Model):
|
|||||||
)
|
)
|
||||||
% rec.name
|
% rec.name
|
||||||
)
|
)
|
||||||
|
if (
|
||||||
|
rec.recurring_next_date
|
||||||
|
and rec.recurring_next_date <= rec.last_date_invoiced
|
||||||
|
):
|
||||||
|
raise ValidationError(
|
||||||
|
_(
|
||||||
|
"You can't have the next invoice date before the date "
|
||||||
|
"of last invoice for the contract line '%s'"
|
||||||
|
)
|
||||||
|
% rec.name
|
||||||
|
)
|
||||||
|
|
||||||
@api.constrains('recurring_next_date')
|
@api.constrains('recurring_next_date')
|
||||||
def _check_recurring_next_date_recurring_invoices(self):
|
def _check_recurring_next_date_recurring_invoices(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user