Browse Source

[IMP] account_financial_report: select accounts between two codes

pull/660/head
Joan Sisquella 5 years ago
parent
commit
afe0090e8d
  1. 28
      account_financial_report/wizard/aged_partner_balance_wizard.py
  2. 15
      account_financial_report/wizard/aged_partner_balance_wizard_view.xml
  3. 25
      account_financial_report/wizard/general_ledger_wizard.py
  4. 31
      account_financial_report/wizard/general_ledger_wizard_view.xml
  5. 27
      account_financial_report/wizard/open_items_wizard.py
  6. 16
      account_financial_report/wizard/open_items_wizard_view.xml
  7. 21
      account_financial_report/wizard/trial_balance_wizard.py
  8. 16
      account_financial_report/wizard/trial_balance_wizard_view.xml

28
account_financial_report/wizard/aged_partner_balance_wizard.py

@ -40,6 +40,34 @@ class AgedPartnerBalanceWizard(models.TransientModel):
)
show_move_line_details = fields.Boolean()
account_code_from = fields.Many2one(
comodel_name='account.account',
string='Account Code From',
help='Starting account in a range')
account_code_to = fields.Many2one(
comodel_name='account.account',
string='Account Code To',
help='Ending account in a range')
@api.onchange('account_code_from', 'account_code_to')
def on_change_account_range(self):
if self.account_code_from and self.account_code_from.code.isdigit() and \
self.account_code_to and self.account_code_to.code.isdigit():
start_range = int(self.account_code_from.code)
end_range = int(self.account_code_to.code)
self.account_ids = self.env['account.account'].search([
('code', 'in', [
x for x in range(start_range, end_range + 1)]),
('reconcile', '=', True)
])
if self.company_id:
self.account_ids = self.account_ids.filtered(
lambda a: a.company_id == self.company_id)
return {'domain': {
'account_code_from': [('reconcile', '=', True)],
'account_code_to': [('reconcile', '=', True)]
}}
@api.onchange('company_id')
def onchange_company_id(self):
"""Handle company change."""

15
account_financial_report/wizard/aged_partner_balance_wizard_view.xml

@ -29,6 +29,21 @@
<label for="account_ids" colspan="4"/>
<field name="receivable_accounts_only"/>
<field name="payable_accounts_only"/>
<label for="account_code_from" string="From Code"/>
<div>
<div class="o_row">
<field name="account_code_from"
class="oe_inline"
options="{'no_create': True}"/>
<span class="oe_inline">
To
</span>
<field name="account_code_to"
class="oe_inline"
options="{'no_create': True}"
/>
</div>
</div>
<field name="account_ids" nolabel="1"
widget="many2many_tags"
options="{'no_create': True}"

25
account_financial_report/wizard/general_ledger_wizard.py

@ -89,10 +89,27 @@ class GeneralLedgerReportWizard(models.TransientModel):
'will display initial and final balance in that currency.',
default=lambda self: self._default_foreign_currency(),
)
partner_ungrouped = fields.Boolean(
string='Partner ungrouped',
help='If set moves are not grouped by partner in any case'
)
account_code_from = fields.Many2one(
comodel_name='account.account',
string='Account Code From',
help='Starting account in a range')
account_code_to = fields.Many2one(
comodel_name='account.account',
string='Account Code To',
help='Ending account in a range')
@api.onchange('account_code_from', 'account_code_to')
def on_change_account_range(self):
if self.account_code_from and self.account_code_from.code.isdigit() and \
self.account_code_to and self.account_code_to.code.isdigit():
start_range = int(self.account_code_from.code)
end_range = int(self.account_code_to.code)
self.account_ids = self.env['account.account'].search(
[('code', 'in', [
x for x in range(start_range, end_range + 1)])])
if self.company_id:
self.account_ids = self.account_ids.filtered(
lambda a: a.company_id == self.company_id)
def _init_date_from(self):
"""set start date to begin of current year if fiscal year running"""

31
account_financial_report/wizard/general_ledger_wizard_view.xml

@ -49,13 +49,30 @@
</group>
<notebook>
<page string="Filter accounts">
<group>
<group>
<field name="account_type_ids" widget="many2many_checkboxes" nolabel="1"/>
</group>
<group>
<field name="account_ids" widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
</group>
<group name="account_filter" col="4">
<label for="account_ids" colspan="4"/>
<field name="receivable_accounts_only"/>
<field name="payable_accounts_only"/>
<label for="account_code_from"
string="From Code"/>
<div>
<div class="o_row">
<field name="account_code_from"
class="oe_inline"
options="{'no_create': True}"/>
<span class="oe_inline">
To
</span>
<field name="account_code_to"
class="oe_inline"
options="{'no_create': True}"
/>
</div>
</div>
<field name="account_ids" nolabel="1"
widget="many2many_tags"
options="{'no_create': True}"
colspan="4"/>
</group>
</page>
<page string="Filter partners">

27
account_financial_report/wizard/open_items_wizard.py

@ -58,6 +58,33 @@ class OpenItemsReportWizard(models.TransientModel):
string='Show Partner Details',
default=True,
)
account_code_from = fields.Many2one(
comodel_name='account.account',
string='Account Code From',
help='Starting account in a range')
account_code_to = fields.Many2one(
comodel_name='account.account',
string='Account Code To',
help='Ending account in a range')
@api.onchange('account_code_from', 'account_code_to')
def on_change_account_range(self):
if self.account_code_from and self.account_code_from.code.isdigit() and \
self.account_code_to and self.account_code_to.code.isdigit():
start_range = int(self.account_code_from.code)
end_range = int(self.account_code_to.code)
self.account_ids = self.env['account.account'].search([
('code', 'in', [
x for x in range(start_range, end_range + 1)]),
('reconcile', '=', True)
])
if self.company_id:
self.account_ids = self.account_ids.filtered(
lambda a: a.company_id == self.company_id)
return {'domain': {
'account_code_from': [('reconcile', '=', True)],
'account_code_to': [('reconcile', '=', True)]
}}
def _default_foreign_currency(self):
return self.env.user.has_group('base.group_multi_currency')

16
account_financial_report/wizard/open_items_wizard_view.xml

@ -32,6 +32,22 @@
<group name="account_filter" col="4">
<field name="receivable_accounts_only"/>
<field name="payable_accounts_only"/>
<label for="account_code_from" string="From Code"/>
<div>
<div class="o_row">
<field name="account_code_from"
class="oe_inline"
options="{'no_create': True}"
/>
<span class="oe_inline">
To
</span>
<field name="account_code_to"
class="oe_inline"
options="{'no_create': True}"
/>
</div>
</div>
<field name="account_ids"
nolabel="1"
widget="many2many_tags"

21
account_financial_report/wizard/trial_balance_wizard.py

@ -83,6 +83,27 @@ class TrialBalanceReportWizard(models.TransientModel):
'account currency is not setup through chart of accounts '
'will display initial and final balance in that currency.'
)
account_code_from = fields.Many2one(
comodel_name='account.account',
string='Account Code From',
help='Starting account in a range')
account_code_to = fields.Many2one(
comodel_name='account.account',
string='Account Code To',
help='Ending account in a range')
@api.onchange('account_code_from', 'account_code_to')
def on_change_account_range(self):
if self.account_code_from and self.account_code_from.code.isdigit() and \
self.account_code_to and self.account_code_to.code.isdigit():
start_range = int(self.account_code_from.code)
end_range = int(self.account_code_to.code)
self.account_ids = self.env['account.account'].search(
[('code', 'in', [
x for x in range(start_range, end_range + 1)])])
if self.company_id:
self.account_ids = self.account_ids.filtered(
lambda a: a.company_id == self.company_id)
@api.multi
@api.constrains('hierarchy_on', 'show_hierarchy_level')

16
account_financial_report/wizard/trial_balance_wizard_view.xml

@ -48,8 +48,20 @@
<label for="account_ids" colspan="4"/>
<field name="receivable_accounts_only"/>
<field name="payable_accounts_only"/>
<field name="account_ids"
nolabel="1"
<label for="account_code_from" string="From Code"/>
<div>
<div class="o_row">
<field name="account_code_from"
class="oe_inline"
options="{'no_create': True}"/>
<span class="oe_inline">To</span>
<field name="account_code_to"
class="oe_inline"
options="{'no_create': True}"
/>
</div>
</div>
<field name="account_ids" nolabel="1"
widget="many2many_tags"
options="{'no_create': True}"
colspan="4"/>

Loading…
Cancel
Save