[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 <jco@odoo.com>
Signed-off-by: Daniel Kosky (dako) <dako@odoo.com>
This commit is contained in:
Daniel Kosky (dako)
2023-11-16 10:19:44 +00:00
parent d85ab80f12
commit c2b160fe50
@@ -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’