From 6bc1399d0d8c383d850d3d6dde87175eb9eea67e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 3 Apr 2018 16:41:35 +0200 Subject: [PATCH] Use OR-ed clause or empty clause and add tax clause when opening tax code issue7307 review42041002 --- tax.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tax.py b/tax.py index 5d045cf012..5806020d96 100644 --- a/tax.py +++ b/tax.py @@ -390,6 +390,7 @@ class TaxCodeLine(ModelSQL, ModelView): @property def _line_domain(self): domain = [ + ('tax', '=', self.tax.id), ('type', '=', self.amount), ] if self.type == 'invoice': @@ -1702,7 +1703,10 @@ class OpenTaxCode(Wizard): TaxCode = pool.get('account.tax.code') Tax = pool.get('account.tax') tax_code = TaxCode(Transaction().context['active_id']) - domain = [l._line_domain for l in tax_code.lines] + if tax_code.lines: + domain = ['OR'] + [l._line_domain for l in tax_code.lines] + else: + domain = ('id', '=', None) action['pyson_domain'] = PYSONEncoder().encode([ Tax._amount_domain(), domain,