[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
This commit is contained in:
Lucas Perais (lpe)
2018-01-29 09:29:24 +01:00
parent e8d719e977
commit af17cd76e4
+3 -1
View File
@@ -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