[FIX] account: allow negative days in payment terms
Negative days are no longer allowed in the Payment Terms since 16.2, although it was possible before. There is no need to block user behaviour if they require negative days (for example, days before end of the month), as the payment term works as expected with negative days. To fix, we remove the constraint _check_positive. To reproduce the issue: - Go to Accounting -> Configuration -> Payment Terms - Edit/Create a Payment Term with a negative value in the 'After' column - When saving, a Validation error appears task-3751491 closes odoo/odoo#157600 X-original-commit: fe1399a1821a05638c638fc4f0437a7aed70e260 Signed-off-by: Quentin De Paoli <qdp@odoo.com>
This commit is contained in:
@@ -278,12 +278,6 @@ class AccountPaymentTermLine(models.Model):
|
||||
if term_line.value == 'percent' and (term_line.value_amount < 0.0 or term_line.value_amount > 100.0):
|
||||
raise ValidationError(_('Percentages on the Payment Terms lines must be between 0 and 100.'))
|
||||
|
||||
@api.constrains('nb_days')
|
||||
def _check_positive(self):
|
||||
for term_line in self:
|
||||
if term_line.nb_days < 0:
|
||||
raise ValidationError(_('The Months and Days of the Payment Terms lines must be positive.'))
|
||||
|
||||
@api.depends('payment_id')
|
||||
def _compute_days(self):
|
||||
for line in self:
|
||||
|
||||
Reference in New Issue
Block a user