From d8931675f47748db7bf581d764f95928db1f52fb Mon Sep 17 00:00:00 2001 From: kasp-odoo Date: Mon, 1 May 2023 18:35:45 +0530 Subject: [PATCH] [IMP] l10n_in_edi: negative discount now allowed Before this commit: Negative discounts could be applied to products, which is not allowed in Indian EDI. After this commit: Applied conditions to check for negative discounts and raise an error in case of such discounts. task_id: 3293247 closes odoo/odoo#135790 X-original-commit: fb1352bc1937d54183173c57094b5b176525d8d6 Signed-off-by: Josse Colpaert --- addons/l10n_in_edi/models/account_edi_format.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/l10n_in_edi/models/account_edi_format.py b/addons/l10n_in_edi/models/account_edi_format.py index a1d459e9350..fc38229d623 100644 --- a/addons/l10n_in_edi/models/account_edi_format.py +++ b/addons/l10n_in_edi/models/account_edi_format.py @@ -77,6 +77,8 @@ class AccountEdiFormat(models.Model): if not move._l10n_in_edi_is_managing_invoice_negative_lines_allowed(): raise ValidationError(_("Invoice lines having a negative amount are not allowed to generate the IRN. " "Please create a credit note instead.")) + if line.display_type == 'product' and line.discount < 0: + error_message.append(_("Negative discount is not allowed, set in line %s", line.name)) if line.product_id: hsn_code = self._l10n_in_edi_extract_digits(line.product_id.l10n_in_hsn_code) if not hsn_code: