diff options
| author | Denis Ledoux <dle@odoo.com> | 2014-06-16 16:55:58 +0200 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2014-06-16 16:55:58 +0200 |
| commit | 63ea0df73ffd6bf659b2ef29cdc3d3387bec92ac (patch) | |
| tree | faa5cf2237f3b7774bece74f561d7970b0859292 | |
| parent | 390c811db87ab7404db420f9cd4e3b4e8db9e048 (diff) | |
[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).
| -rw-r--r-- | addons/account/account_invoice.py | 3 |
1 files changed, 2 insertions, 1 deletions
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', |
