From 234cfcdc898e04aa5843f9933e8a03e4ff8ab6a0 Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Thu, 21 Sep 2017 10:11:18 +0200 Subject: [PATCH] [FIX] account: fix type of journals in account.payment. --- addons/account/models/account_payment.py | 6 ++++-- addons/account/views/account_payment_view.xml | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index e3b923aca12..fe353bb1574 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -323,15 +323,17 @@ class account_payment(models.Model): if self.currency_id.is_zero(self.amount): # In case of payment with 0 amount, allow to select a journal of type 'general' like # 'Miscellaneous Operations' and set this journal by default. - journal_type.append('general') + journal_type = ['general'] self.payment_difference_handling = 'reconcile' - self.journal_id = self.env['account.journal'].search([('type', '=', 'general')], limit=1) else: if self.payment_type == 'inbound': domain.append(('at_least_one_inbound', '=', True)) else: domain.append(('at_least_one_outbound', '=', True)) + domain.append(('type', 'in', journal_type)) + if self.journal_id.type not in journal_type: + self.journal_id = self.env['account.journal'].search([('type', 'in', journal_type)], limit=1) return {'domain': {'journal_id': domain}} @api.one diff --git a/addons/account/views/account_payment_view.xml b/addons/account/views/account_payment_view.xml index 18bed5ed15c..e4dfd90dd77 100644 --- a/addons/account/views/account_payment_view.xml +++ b/addons/account/views/account_payment_view.xml @@ -146,16 +146,16 @@ - - - - -