Use OR-ed clause or empty clause and add tax clause when opening tax code

issue7307
review42041002
This commit is contained in:
Cédric Krier committed 2018-04-03 16:41:35 +02:00
1 parent 676b4fb297
commit 6bc1399d0d
1 file changed
+5 -1
+5 -1
View File
@@ -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,