From c2b160fe50c24e9f01d0d5b350f2422cfdbc72d4 Mon Sep 17 00:00:00 2001 From: "Daniel Kosky (dako)" Date: Wed, 15 Nov 2023 16:34:20 +0100 Subject: [PATCH] [FIX] l10n_ke_edi_tremol: Kenyan partner vat bug In a recent fix (de77cef), the Kenyan EDI was adapted to exclude VAT numbers for non-Kenyan partners. The field was also adapted to be stripped before being serialised (due to a particular bug originating from a space in front of the VAT). Stripping this field results in a traceback when the field is empty, since the type is not adapted from a bool to an empty string first. This commit corrects this by using an empty string if the partner vat is False. It also adapts the check to specifically use the country of the commercial partner id instead of that of the partner. task-id:None closes odoo/odoo#142262 X-original-commit: b720833f5e52e14e379efcd51cfc559c57100a77 Signed-off-by: Josse Colpaert Signed-off-by: Daniel Kosky (dako) --- addons/l10n_ke_edi_tremol/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_ke_edi_tremol/models/account_move.py b/addons/l10n_ke_edi_tremol/models/account_move.py index d4b00b48b06..8282e0a9147 100644 --- a/addons/l10n_ke_edi_tremol/models/account_move.py +++ b/addons/l10n_ke_edi_tremol/models/account_move.py @@ -96,7 +96,7 @@ class AccountMove(models.Model): headquarter_address = (self.commercial_partner_id.street or '') + (self.commercial_partner_id.street2 or '') customer_address = (self.partner_id.street or '') + (self.partner_id.street2 or '') postcode_and_city = (self.partner_id.zip or '') + '' + (self.partner_id.city or '') - vat = self.commercial_partner_id.vat.strip() if self.partner_id.country_id.code == 'KE' else '' + vat = (self.commercial_partner_id.vat or '').strip() if self.commercial_partner_id.country_id.code == 'KE' else '' invoice_elements = [ b'1', # Reserved - 1 symbol with value '1' b' 0', # Reserved - 6 symbols with value ‘ 0’