From c6481ee9d5350beeeb3eab1d24f7386315d7b42e Mon Sep 17 00:00:00 2001 From: Abraham Cabezas Date: Sun, 11 Oct 2020 13:02:20 +0200 Subject: [PATCH] Add domain to invoice's journal issue5175 review310491002 --- CHANGELOG | 1 + invoice.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 3838ecbd27..f743f2d1c9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add domain to invoice's journal * Add optional taxes date on invoice line * Convert Invoice.update_taxes into dualmethod * Rename invoice state from cancel to cancelled diff --git a/invoice.py b/invoice.py index c4bd81d9dc..ac492aaf9a 100644 --- a/invoice.py +++ b/invoice.py @@ -116,7 +116,13 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin): currency_date = fields.Function(fields.Date('Currency Date'), 'on_change_with_currency_date') journal = fields.Many2One('account.journal', 'Journal', required=True, - states=_states, depends=_depends) + states=_states, + domain=[ + If(Eval('type') == 'out', + ('type', '=', 'revenue'), + ('type', '=', 'expense')) + ], + depends=_depends + ['type']) move = fields.Many2One('account.move', 'Move', readonly=True, domain=[ ('company', '=', Eval('company', -1)),