Browse Source

[IMP] Tax balance display all

pull/801/head
Mateu Griful 3 years ago
parent
commit
6c8f5655d9
  1. 12
      account_tax_balance/models/account_tax.py
  2. 5
      account_tax_balance/wizard/open_tax_balances.py
  3. 1
      account_tax_balance/wizard/open_tax_balances_view.xml

12
account_tax_balance/models/account_tax.py

@ -39,6 +39,7 @@ class AccountTax(models.Model):
context.get('to_date', fields.Date.context_today(self)),
context.get('company_id', self.env.user.company_id.id),
context.get('target_move', 'posted'),
context.get('display_all', False),
)
def _account_tax_ids_with_moves(self):
@ -69,7 +70,8 @@ class AccountTax(models.Model):
)
)
"""
from_date, to_date, company_id, target_move = self.get_context_values()
from_date, to_date, company_id, target_move, display_all \
= self.get_context_values()
self.env.cr.execute(
req, (company_id, from_date, to_date, company_id))
return [r[0] for r in self.env.cr.fetchall()]
@ -86,8 +88,13 @@ class AccountTax(models.Model):
@api.model
def _search_has_moves(self, operator, value):
from_date, to_date, company_id, target_move, display_all \
= self.get_context_values()
if self._is_unsupported_search_operator(operator) or not value:
raise ValueError(_("Unsupported search operator"))
if display_all:
ids_with_moves = self.env['account.tax'].search([]).ids
else:
ids_with_moves = self._account_tax_ids_with_moves()
return [('id', 'in', ids_with_moves)]
@ -161,7 +168,8 @@ class AccountTax(models.Model):
return domain
def get_move_lines_domain(self, tax_or_base='tax', move_type=None):
from_date, to_date, company_id, target_move = self.get_context_values()
from_date, to_date, company_id, target_move, display_all \
= self.get_context_values()
state_list = self.get_target_state_list(target_move)
type_list = self.get_target_type_list(move_type)
domain = self.get_move_line_partial_domain(

5
account_tax_balance/wizard/open_tax_balances.py

@ -18,6 +18,10 @@ class WizardOpenTaxBalances(models.TransientModel):
('posted', 'All Posted Entries'),
('all', 'All Entries'),
], 'Target Moves', required=True, default='posted')
display_all = fields.Boolean(
string="Force display of all tax accounts",
default=False
)
@api.onchange('date_range_id')
def onchange_date_range_id(self):
@ -55,5 +59,6 @@ class WizardOpenTaxBalances(models.TransientModel):
'to_date': self.to_date,
'target_move': self.target_move,
'company_id': self.company_id.id,
'display_all': self.display_all,
}
return vals

1
account_tax_balance/wizard/open_tax_balances_view.xml

@ -13,6 +13,7 @@
<field name="from_date"></field>
<field name="to_date"></field>
<field name="target_move"></field>
<field name="display_all"></field>
</group>
<footer>
<button string="Open Taxes" name="open_taxes" type="object" class="oe_highlight"/>

Loading…
Cancel
Save