[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 <jco@odoo.com>
This commit is contained in:
Nidhi Patel
2022-10-04 12:30:16 +02:00
committed by Jigar Vaghela
parent f52486dcc4
commit 2a47e097c0
2 changed files with 5 additions and 5 deletions
@@ -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,
+2 -2
View File
@@ -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)