From 210e249b774caf2749cc1fe2350c19f6fe943b74 Mon Sep 17 00:00:00 2001 From: "Maira Salazar (srma)" Date: Mon, 19 Feb 2024 12:43:29 +0100 Subject: [PATCH] [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 --- addons/account/models/account_payment_term.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/addons/account/models/account_payment_term.py b/addons/account/models/account_payment_term.py index c6f25724890..27f7336840e 100644 --- a/addons/account/models/account_payment_term.py +++ b/addons/account/models/account_payment_term.py @@ -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: