From af17cd76e43b862c33f51e5a2fa7d7419b88c779 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Fri, 19 Jan 2018 17:05:55 +0100 Subject: [PATCH] [FIX] account: onchange payment type to internal displays all journals on account.payment, when changing the payment type to Internal Transfer, the result of the onchange was erroneous as inbound and outbound methods lack relevance in that case After this commit, We choose to display all bank and cash journals in this case OPW 804214 --- addons/account/models/account_payment.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index a2e73bbab01..b1d8012329d 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -256,11 +256,13 @@ class account_payment(models.Model): self.partner_type = 'customer' elif self.payment_type == 'outbound': self.partner_type = 'supplier' + else: + self.partner_type = False # Set payment method domain res = self._onchange_journal() if not res.get('domain', {}): res['domain'] = {} - res['domain']['journal_id'] = self.payment_type == 'inbound' and [('at_least_one_inbound', '=', True)] or [('at_least_one_outbound', '=', True)] + res['domain']['journal_id'] = self.payment_type == 'inbound' and [('at_least_one_inbound', '=', True)] or self.payment_type == 'outbound' and [('at_least_one_outbound', '=', True)] or [] res['domain']['journal_id'].append(('type', 'in', ('bank', 'cash'))) return res