From 63ea0df73ffd6bf659b2ef29cdc3d3387bec92ac Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 16 Jun 2014 16:55:58 +0200 Subject: [PATCH] [FIX] account: default domain on journal_id field for invoices Prior to this fix, the domain was set in the onchange methods onchange_company_id. Therefore, if the onchange was not triggered, the domain wasnt apply (e.g. while editing an existing invoice). --- addons/account/account_invoice.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 55ba1058d58..afd0077bbc8 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -298,7 +298,8 @@ class account_invoice(osv.osv): }, multi='all'), 'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}, track_visibility='always'), - 'journal_id': fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}), + 'journal_id': fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}, + domain="[('type', 'in', {'out_invoice': ['sale'], 'out_refund': ['sale_refund'], 'in_refund': ['purchase_refund'], 'in_invoice': ['purchase']}.get(type, [])), ('company_id', '=', company_id)]"), 'company_id': fields.many2one('res.company', 'Company', required=True, change_default=True, readonly=True, states={'draft':[('readonly',False)]}), 'check_total': fields.float('Verification Total', digits_compute=dp.get_precision('Account'), readonly=True, states={'draft':[('readonly',False)]}), 'reconciled': fields.function(_reconciled, string='Paid/Reconciled', type='boolean',