From f1bdf63830a98c37d14b5c0ea0044bf7eef28ab6 Mon Sep 17 00:00:00 2001 From: Swapnesh Shah Date: Sun, 12 Jan 2020 09:35:16 +0000 Subject: [PATCH] [FIX] l10n_ch: Update l10n_ch_postal if related field is set Fixes https://github.com/odoo/odoo/issues/43122 Before this commit, Creating Journal without Bank account number will be failed as, It tries to update Related field 'l10n_ch_postal' while bank_account_id is not set. In this commit, we update 'l10n_ch_postal' if 'bank_account_id' is present on Journal closes odoo/odoo#43302 X-original-commit: 6ddd93bf615c95675c13cc989b8a6f835de04324 Signed-off-by: oco-odoo --- addons/l10n_ch/models/account_journal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_ch/models/account_journal.py b/addons/l10n_ch/models/account_journal.py index 716823c8621..9076a9f128d 100644 --- a/addons/l10n_ch/models/account_journal.py +++ b/addons/l10n_ch/models/account_journal.py @@ -30,7 +30,7 @@ class AccountJournal(models.Model): # The call to super() creates the related bank_account_id field if necessary if 'l10n_ch_postal' in vals: - for record in self: + for record in self.filtered('bank_account_id'): record.bank_account_id.l10n_ch_postal = vals['l10n_ch_postal'] return rslt