From 6f30abe2584420df2fa678c9d683a2cd76c4054e Mon Sep 17 00:00:00 2001 From: Nidhi Patel Date: Tue, 9 Aug 2022 10:53:58 +0000 Subject: [PATCH] [FIX] l10n_in_edi: export without shipping details Before this commit, when we create an export Invoice ( foreign customer ) without shipping details and processing the invoice, the system asks for mandatory to provide details of shipping, which are not compulsory to generate an E-Invoice in India. After this commit, the system will proceed with E-Invoicing in case of export without shipping details on the invoice form. closes odoo/odoo#98737 Task-id: 2948375 X-original-commit: d2d68fcc6c019847b552f3a61b6fabebeb13a354 Signed-off-by: Josse Colpaert --- addons/l10n_in_edi/models/account_edi_format.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/addons/l10n_in_edi/models/account_edi_format.py b/addons/l10n_in_edi/models/account_edi_format.py index 6b7714b9ae9..a054d4b3acd 100644 --- a/addons/l10n_in_edi/models/account_edi_format.py +++ b/addons/l10n_in_edi/models/account_edi_format.py @@ -408,15 +408,23 @@ class AccountEdiFormat(models.Model): if is_overseas: json_payload.update({ "ExpDtls": { - "ShipBNo": invoice.l10n_in_shipping_bill_number or "", - "ShipBDt": invoice.l10n_in_shipping_bill_date - and invoice.l10n_in_shipping_bill_date.strftime("%d/%m/%Y") or "", - "Port": invoice.l10n_in_shipping_port_code_id.code or "", "RefClm": tax_details_by_code.get("igst") and "Y" or "N", "ForCur": invoice.currency_id.name, "CntCode": saler_buyer.get("buyer_details").country_id.code or "", } }) + if invoice.l10n_in_shipping_bill_number: + json_payload["ExpDtls"].update({ + "ShipBNo": invoice.l10n_in_shipping_bill_number, + }) + if invoice.l10n_in_shipping_bill_date: + json_payload["ExpDtls"].update({ + "ShipBDt": invoice.l10n_in_shipping_bill_date.strftime("%d/%m/%Y"), + }) + if invoice.l10n_in_shipping_port_code_id: + json_payload["ExpDtls"].update({ + "Port": invoice.l10n_in_shipping_port_code_id.code + }) return json_payload @api.model