Browse Source

[IMP] mis_builder: fix and improve get_aml_domain_for_expr

pull/90/head
Stéphane Bidoul 10 years ago
parent
commit
9a36751f2d
  1. 9
      mis_builder/models/aep.py

9
mis_builder/models/aep.py

@ -145,13 +145,18 @@ class AccountingExpressionProcessor(object):
domains = [] domains = []
for mo in self.ACC_RE.finditer(expr): for mo in self.ACC_RE.finditer(expr):
_, mode, account_codes, domain = self._parse_mo(mo)
field, mode, account_codes, domain = self._parse_mo(mo)
if mode == 'i': if mode == 'i':
continue continue
account_ids = set() account_ids = set()
for account_code in account_codes: for account_code in account_codes:
account_ids.update(self._account_ids_by_code[account_code]) account_ids.update(self._account_ids_by_code[account_code])
domains.append([('account_id', 'in', tuple(account_ids))])
domain = [('account_id', 'in', tuple(account_ids))]
if field == 'crd':
domain.append(('credit', '>', 0))
elif field == 'deb':
domain.append(('debit', '>', 0))
domain.extend(domain)
domains.append(domain) domains.append(domain)
return or_domains(domains) return or_domains(domains)

Loading…
Cancel
Save