From 8989a211bc0528587d4718ec6df56072dddaf3e3 Mon Sep 17 00:00:00 2001 From: Zeel Patel Date: Thu, 3 Aug 2023 13:14:58 +0000 Subject: [PATCH] [FIX] l10n_in_edi: prevent traceback when give invalid zip code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit Previously, there was a bug that caused an error when a zip code containing any character was entered. After this commit This bug has been fixed now. task id- 3441139 closes odoo/odoo#130942 X-original-commit: 8deeabdbfbee20289d79151fa2821ce04585d0bd Signed-off-by: de Wouters de Bouchout Jean-BenoƮt (jbw) Signed-off-by: Zeel Patel (zepa) --- addons/l10n_in_edi/models/account_edi_format.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/l10n_in_edi/models/account_edi_format.py b/addons/l10n_in_edi/models/account_edi_format.py index 2112f72e0aa..a1d459e9350 100644 --- a/addons/l10n_in_edi/models/account_edi_format.py +++ b/addons/l10n_in_edi/models/account_edi_format.py @@ -255,10 +255,11 @@ class AccountEdiFormat(models.Model): if is_overseas is true then pin is 999999 and GSTIN(vat) is URP and Stcd is . if pos_state_id is passed then we use set POS """ + zip_digits = self._l10n_in_edi_extract_digits(partner.zip) partner_details = { "Addr1": partner.street or "", "Loc": partner.city or "", - "Pin": int(self._l10n_in_edi_extract_digits(partner.zip)), + "Pin": zip_digits and int(zip_digits) or "", "Stcd": partner.state_id.l10n_in_tin or "", } if partner.street2: