From ebd85820b87a2da4e83fcf059f3b2f061b903823 Mon Sep 17 00:00:00 2001 From: nie Date: Mon, 1 Feb 2021 15:32:10 +0000 Subject: [PATCH] [FIX] l10n_ch: use commercial company name in invoice PDF Steps: - Edit the current company (1): - Country: Switzerland - Currency: CHF - Install l10n_ch - Go to Invoicing > Configuration > Bank Accounts - Edit Bank: - Bank Account: create a new one: - Account Holder: (1) - Go to Configuration > Journal - Edit Customer Invoices: - Advanced Settings tab: - Communication Standards: Switzerland - Go to Customers > Customers - Create a new customer (2): - Fill in street, city, zip code and country - Edit (2): - Contacts & Addresses tab: - Add: - Select Invoice Address - Contact Name: Keep this field blank - Go to Customers > Invoices - Create a new one: - Customer: "(2), Invoice Address" - Add a product - Validate it - Click Print QR-Bill Bug: Traceback here: https://github.com/odoo/odoo/blob/b76e9ef658bde0178fa1660b6ad27b880e91632a/addons/l10n_ch/models/res_bank.py#L129 TypeError: 'bool' object is not subscriptable Explanation: The contact name of an address is optional. When nothing is filled in that field, it returns `False`, hence the error. Using the commercial company name ensures a name is put in the invoice, even if the contact doesn't belong to a company. opw:2447158 closes odoo/odoo#65417 X-original-commit: 2537bb01675279f08edf65077e6d41a5bd968ec4 Signed-off-by: backspac --- addons/l10n_ch/models/res_bank.py | 2 +- addons/l10n_ch/report/swissqr_report.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/l10n_ch/models/res_bank.py b/addons/l10n_ch/models/res_bank.py index 334a3d4cc0e..47be59cb370 100644 --- a/addons/l10n_ch/models/res_bank.py +++ b/addons/l10n_ch/models/res_bank.py @@ -226,7 +226,7 @@ class ResPartnerBank(models.Model): '{:.2f}'.format(amount), # Amount currency.name, # Currency 'K', # Ultimate Debtor Address Type - debtor_partner.name[:70], # Ultimate Debtor Name + debtor_partner.commercial_company_name[:70], # Ultimate Debtor Name debtor_addr_1, # Ultimate Debtor Address Line 1 debtor_addr_2, # Ultimate Debtor Address Line 2 '', # Ultimate Debtor Postal Code (not to be provided for address type K) diff --git a/addons/l10n_ch/report/swissqr_report.xml b/addons/l10n_ch/report/swissqr_report.xml index 92bd21418d2..5fc7134963b 100644 --- a/addons/l10n_ch/report/swissqr_report.xml +++ b/addons/l10n_ch/report/swissqr_report.xml @@ -60,7 +60,7 @@
Payable by
-
+

@@ -124,7 +124,7 @@
Payable by
-
+