diff options
| author | qdp-odoo <qdp@odoo.com> | 2017-09-21 10:11:18 +0200 |
|---|---|---|
| committer | qdp-odoo <qdp@odoo.com> | 2017-09-21 10:12:38 +0200 |
| commit | 234cfcdc898e04aa5843f9933e8a03e4ff8ab6a0 (patch) | |
| tree | 4fb44334c6f15f6c5646165c79cdb9ca57b5075a | |
| parent | 0b5a743641f6823252fe155cf6d8baaf3b929c33 (diff) | |
[FIX] account: fix type of journals in account.payment.
| -rw-r--r-- | addons/account/models/account_payment.py | 6 | ||||
| -rw-r--r-- | 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 @@ <field name="payment_type" widget="radio" attrs="{'readonly': [('state', '!=', 'draft')]}"/> <field name="partner_type" widget="selection" attrs="{'required': [('payment_type', 'in', ('inbound', 'outbound'))], 'invisible': [('payment_type', 'not in', ('inbound', 'outbound'))], 'readonly': [('state', '!=', 'draft')]}"/> <field name="partner_id" attrs="{'required': [('payment_type', 'in', ('inbound', 'outbound'))], 'invisible': [('payment_type', 'not in', ('inbound', 'outbound'))], 'readonly': [('state', '!=', 'draft')]}" context="{'default_is_company': True, 'default_supplier': payment_type == 'outbound', 'default_customer': payment_type == 'inbound'}"/> - <field name="journal_id" widget="selection" attrs="{'readonly': [('state', '!=', 'draft')]}"/> - <field name="destination_journal_id" widget="selection" attrs="{'required': [('payment_type', '=', 'transfer')], 'invisible': [('payment_type', '!=', 'transfer')], 'readonly': [('state', '!=', 'draft')]}"/> - <field name="hide_payment_method" invisible="1"/> - <field name="payment_method_id" string=" " widget="radio" attrs="{'invisible': [('hide_payment_method', '=', True)], 'readonly': [('state', '!=', 'draft')]}"/> - <field name="payment_method_code" invisible="1"/> <label for="amount"/> <div name="amount_div" class="o_row"> <field name="amount" attrs="{'readonly': [('state', '!=', 'draft')]}"/> <field name="currency_id" options="{'no_create': True, 'no_open': True}" groups="base.group_multi_currency" attrs="{'readonly': [('state', '!=', 'draft')]}"/> </div> + <field name="journal_id" widget="selection" attrs="{'readonly': [('state', '!=', 'draft')]}"/> + <field name="destination_journal_id" widget="selection" attrs="{'required': [('payment_type', '=', 'transfer')], 'invisible': [('payment_type', '!=', 'transfer')], 'readonly': [('state', '!=', 'draft')]}"/> + <field name="hide_payment_method" invisible="1"/> + <field name="payment_method_id" string=" " widget="radio" attrs="{'invisible': [('hide_payment_method', '=', True)], 'readonly': [('state', '!=', 'draft')]}"/> + <field name="payment_method_code" invisible="1"/> </group> <group> <field name="payment_date" attrs="{'readonly': [('state', '!=', 'draft')]}"/> |
