[IMP] account_financial_report: open_items & aged_partner_balance
* Now account_ids is empty by default and required * Domain is applied in the selection of the accountspull/939/head
parent
8e1d90bef9
commit
20dd57c240
|
@ -27,7 +27,10 @@ class AgedPartnerBalanceWizard(models.TransientModel):
|
||||||
default="posted",
|
default="posted",
|
||||||
)
|
)
|
||||||
account_ids = fields.Many2many(
|
account_ids = fields.Many2many(
|
||||||
comodel_name="account.account", string="Filter accounts"
|
comodel_name='account.account',
|
||||||
|
string='Filter accounts',
|
||||||
|
domain=[('reconcile', '=', True)],
|
||||||
|
required=True,
|
||||||
)
|
)
|
||||||
receivable_accounts_only = fields.Boolean()
|
receivable_accounts_only = fields.Boolean()
|
||||||
payable_accounts_only = fields.Boolean()
|
payable_accounts_only = fields.Boolean()
|
||||||
|
@ -56,7 +59,11 @@ class AgedPartnerBalanceWizard(models.TransientModel):
|
||||||
res["domain"]["partner_ids"] += self._get_partner_ids_domain()
|
res["domain"]["partner_ids"] += self._get_partner_ids_domain()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.onchange("receivable_accounts_only", "payable_accounts_only")
|
@api.onchange('account_ids')
|
||||||
|
def onchange_account_ids(self):
|
||||||
|
return {'domain': {'account_ids': [('reconcile', '=', True)]}}
|
||||||
|
|
||||||
|
@api.onchange('receivable_accounts_only', 'payable_accounts_only')
|
||||||
def onchange_type_accounts_only(self):
|
def onchange_type_accounts_only(self):
|
||||||
"""Handle receivable/payable accounts only change."""
|
"""Handle receivable/payable accounts only change."""
|
||||||
domain = [("company_id", "=", self.company_id.id)]
|
domain = [("company_id", "=", self.company_id.id)]
|
||||||
|
@ -66,10 +73,10 @@ class AgedPartnerBalanceWizard(models.TransientModel):
|
||||||
elif self.receivable_accounts_only:
|
elif self.receivable_accounts_only:
|
||||||
domain += [("internal_type", "=", "receivable")]
|
domain += [("internal_type", "=", "receivable")]
|
||||||
elif self.payable_accounts_only:
|
elif self.payable_accounts_only:
|
||||||
domain += [("internal_type", "=", "payable")]
|
domain += [('internal_type', '=', 'payable')]
|
||||||
elif not self.receivable_accounts_only and not self.payable_accounts_only:
|
self.account_ids = self.env['account.account'].search(domain)
|
||||||
domain += [("reconcile", "=", True)]
|
else:
|
||||||
self.account_ids = self.env["account.account"].search(domain)
|
self.account_ids = None
|
||||||
|
|
||||||
def _print_report(self, report_type):
|
def _print_report(self, report_type):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
|
|
|
@ -28,9 +28,10 @@ class OpenItemsReportWizard(models.TransientModel):
|
||||||
default="posted",
|
default="posted",
|
||||||
)
|
)
|
||||||
account_ids = fields.Many2many(
|
account_ids = fields.Many2many(
|
||||||
comodel_name="account.account",
|
comodel_name='account.account',
|
||||||
string="Filter accounts",
|
string='Filter accounts',
|
||||||
domain=[("reconcile", "=", True)],
|
domain=[('reconcile', '=', True)],
|
||||||
|
required=True,
|
||||||
)
|
)
|
||||||
hide_account_at_0 = fields.Boolean(
|
hide_account_at_0 = fields.Boolean(
|
||||||
string="Hide account ending balance at 0",
|
string="Hide account ending balance at 0",
|
||||||
|
@ -80,7 +81,11 @@ class OpenItemsReportWizard(models.TransientModel):
|
||||||
res["domain"]["partner_ids"] += self._get_partner_ids_domain()
|
res["domain"]["partner_ids"] += self._get_partner_ids_domain()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.onchange("receivable_accounts_only", "payable_accounts_only")
|
@api.onchange('account_ids')
|
||||||
|
def onchange_account_ids(self):
|
||||||
|
return {'domain': {'account_ids': [('reconcile', '=', True)]}}
|
||||||
|
|
||||||
|
@api.onchange('receivable_accounts_only', 'payable_accounts_only')
|
||||||
def onchange_type_accounts_only(self):
|
def onchange_type_accounts_only(self):
|
||||||
"""Handle receivable/payable accounts only change."""
|
"""Handle receivable/payable accounts only change."""
|
||||||
domain = [("company_id", "=", self.company_id.id)]
|
domain = [("company_id", "=", self.company_id.id)]
|
||||||
|
@ -90,10 +95,10 @@ class OpenItemsReportWizard(models.TransientModel):
|
||||||
elif self.receivable_accounts_only:
|
elif self.receivable_accounts_only:
|
||||||
domain += [("internal_type", "=", "receivable")]
|
domain += [("internal_type", "=", "receivable")]
|
||||||
elif self.payable_accounts_only:
|
elif self.payable_accounts_only:
|
||||||
domain += [("internal_type", "=", "payable")]
|
domain += [('internal_type', '=', 'payable')]
|
||||||
elif not self.receivable_accounts_only and not self.payable_accounts_only:
|
self.account_ids = self.env['account.account'].search(domain)
|
||||||
domain += [("reconcile", "=", True)]
|
else:
|
||||||
self.account_ids = self.env["account.account"].search(domain)
|
self.account_ids = None
|
||||||
|
|
||||||
def _print_report(self, report_type):
|
def _print_report(self, report_type):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
|
|
Loading…
Reference in New Issue