[REF] account_tax_balance: Allow to override query
parent
a85c46e0ae
commit
ecc5882e23
|
@ -32,17 +32,10 @@ class AccountTax(models.Model):
|
||||||
context.get("target_move", "posted"),
|
context.get("target_move", "posted"),
|
||||||
)
|
)
|
||||||
|
|
||||||
def _account_tax_ids_with_moves(self):
|
def _account_tax_ids_with_moves_query(self):
|
||||||
"""Return all account.tax ids for which there is at least
|
|
||||||
one account.move.line in the context period
|
|
||||||
for the user company.
|
|
||||||
|
|
||||||
Caveat: this ignores record rules and ACL but it is good
|
|
||||||
enough for filtering taxes with activity during the period.
|
|
||||||
"""
|
|
||||||
from_date, to_date, company_ids, _ = self.get_context_values()
|
from_date, to_date, company_ids, _ = self.get_context_values()
|
||||||
company_ids = tuple(company_ids)
|
company_ids = tuple(company_ids)
|
||||||
req = """
|
query = """
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM account_tax at
|
FROM account_tax at
|
||||||
WHERE
|
WHERE
|
||||||
|
@ -62,7 +55,19 @@ class AccountTax(models.Model):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
self.env.cr.execute(req, (company_ids, from_date, to_date, company_ids))
|
params = (company_ids, from_date, to_date, company_ids)
|
||||||
|
return query, params
|
||||||
|
|
||||||
|
def _account_tax_ids_with_moves(self):
|
||||||
|
"""Return all account.tax ids for which there is at least
|
||||||
|
one account.move.line in the context period
|
||||||
|
for the user company.
|
||||||
|
|
||||||
|
Caveat: this ignores record rules and ACL but it is good
|
||||||
|
enough for filtering taxes with activity during the period.
|
||||||
|
"""
|
||||||
|
query, params = self._account_tax_ids_with_moves_query()
|
||||||
|
self.env.cr.execute(query, params)
|
||||||
return [r[0] for r in self.env.cr.fetchall()]
|
return [r[0] for r in self.env.cr.fetchall()]
|
||||||
|
|
||||||
def _compute_has_moves(self):
|
def _compute_has_moves(self):
|
||||||
|
|
Loading…
Reference in New Issue