[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 <oco-odoo@users.noreply.github.com>
This commit is contained in:
Swapnesh Shah
2020-01-14 17:01:27 +00:00
parent 1dc3301332
commit f1bdf63830
+1 -1
View File
@@ -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