From 2a47e097c020b656473bcfe96ba8729c844c5d45 Mon Sep 17 00:00:00 2001 From: Nidhi Patel Date: Mon, 3 Oct 2022 05:57:05 +0000 Subject: [PATCH] [FIX] l10n_in_edi: correct reference of tag_ids Before this commit ================== before this commit, it will raise the error when submitting EDI because the tax report line does not exist and it will be removed from this PR #99401 After this commit ================= no error will be raised and it will get related tag_ids closes odoo/odoo#101988 X-original-commit: 9a60822ae9227d7fa815b06cb0a26629ec075e1e Signed-off-by: Josse Colpaert --- addons/l10n_in_edi/models/account_edi_format.py | 6 +++--- addons/l10n_in_edi/tests/test_edi_json.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/l10n_in_edi/models/account_edi_format.py b/addons/l10n_in_edi/models/account_edi_format.py index 2412df9301b..80a27f63a4e 100644 --- a/addons/l10n_in_edi/models/account_edi_format.py +++ b/addons/l10n_in_edi/models/account_edi_format.py @@ -427,19 +427,19 @@ class AccountEdiFormat(models.Model): tags = tax_values['tax_repartition_line'].tag_ids line_code = "other" if not invl.currency_id.is_zero(tax_values['tax_amount_currency']): - if any(tag in tags for tag in self.env.ref("l10n_in.tax_report_line_cess").sudo().tag_ids): + if any(tag in tags for tag in self.env.ref("l10n_in.tax_tag_cess")): if tax.amount_type != "percent": line_code = "cess_non_advol" else: line_code = "cess" - elif any(tag in tags for tag in self.env.ref("l10n_in.tax_report_line_state_cess").sudo().tag_ids): + elif any(tag in tags for tag in self.env.ref("l10n_in.tax_tag_state_cess")): if tax.amount_type != "percent": line_code = "state_cess_non_advol" else: line_code = "state_cess" else: for gst in ["cgst", "sgst", "igst"]: - if any(tag in tags for tag in self.env.ref("l10n_in.tax_report_line_%s"%(gst)).sudo().tag_ids): + if any(tag in tags for tag in self.env.ref("l10n_in.tax_tag_%s"%(gst))): line_code = gst return { "tax": tax, diff --git a/addons/l10n_in_edi/tests/test_edi_json.py b/addons/l10n_in_edi/tests/test_edi_json.py index 1a3cc28a879..86ba0c00a4f 100644 --- a/addons/l10n_in_edi/tests/test_edi_json.py +++ b/addons/l10n_in_edi/tests/test_edi_json.py @@ -58,7 +58,7 @@ class TestEdiJson(AccountTestInvoicingCommon): cls.invoice_zero_qty.action_post() def test_edi_json(self): - # json_value = self.env["account.edi.format"]._l10n_in_edi_generate_invoice_json(self.invoice) + json_value = self.env["account.edi.format"]._l10n_in_edi_generate_invoice_json(self.invoice) expected = { "Version": "1.1", "TranDtls": {"TaxSch": "GST", "SupTyp": "B2B", "RegRev": "N", "IgstOnIntra": "N"}, @@ -101,7 +101,7 @@ class TestEdiJson(AccountTestInvoicingCommon): "StCesVal": 0.0, "RndOffAmt": 0.0, "TotInvVal": 1999.59 } } - # self.assertDictEqual(json_value, expected, "Indian EDI send json value is not matched") + self.assertDictEqual(json_value, expected, "Indian EDI send json value is not matched") #=================================== Full discount test ===================================== json_value = self.env["account.edi.format"]._l10n_in_edi_generate_invoice_json(self.invoice_full_discount)