[account_financial_report][IMP] Adds the following:
All reports: - Rename field to hide accounts at 0 to 'hide_account_at_0' Trial Balance: - Add possibility to filter by hierarchy levels - XLSX format will show the hierarchy levels in bold General Ledger: - Add the possibility to filter by analytic tags - Fixes an error on the default date Journal Ledger: - The filter on Journals is now optional. If the user does not choose a journal, by default it will display all journals. Aged Partner Balance: - Fixes an error on the default date
This commit is contained in:
committed by
chaule97
parent
1aa03c7bb7
commit
99fb232194
@@ -3,7 +3,6 @@
|
||||
# Copyright 2016 Camptocamp SA, Onestein B.V.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from datetime import datetime
|
||||
from odoo import api, fields, models
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
from odoo.tools import pycompat
|
||||
@@ -21,7 +20,7 @@ class AgedPartnerBalanceWizard(models.TransientModel):
|
||||
string='Company'
|
||||
)
|
||||
date_at = fields.Date(required=True,
|
||||
default=fields.Date.to_string(datetime.today()))
|
||||
default=fields.Date.context_today)
|
||||
target_move = fields.Selection([('posted', 'All Posted Entries'),
|
||||
('all', 'All Entries')],
|
||||
string='Target Moves',
|
||||
|
||||
@@ -41,19 +41,26 @@ class GeneralLedgerReportWizard(models.TransientModel):
|
||||
)
|
||||
centralize = fields.Boolean(string='Activate centralization',
|
||||
default=True)
|
||||
hide_account_balance_at_0 = fields.Boolean(
|
||||
hide_account_at_0 = fields.Boolean(
|
||||
string='Hide account ending balance at 0',
|
||||
help='Use this filter to hide an account or a partner '
|
||||
'with an ending balance at 0. '
|
||||
'If partners are filtered, '
|
||||
'debits and credits totals will not match the trial balance.'
|
||||
)
|
||||
show_analytic_tags = fields.Boolean(
|
||||
string='Show analytic tags',
|
||||
)
|
||||
receivable_accounts_only = fields.Boolean()
|
||||
payable_accounts_only = fields.Boolean()
|
||||
partner_ids = fields.Many2many(
|
||||
comodel_name='res.partner',
|
||||
string='Filter partners',
|
||||
)
|
||||
analytic_tag_ids = fields.Many2many(
|
||||
comodel_name='account.analytic.tag',
|
||||
string='Filter accounts',
|
||||
)
|
||||
account_journal_ids = fields.Many2many(
|
||||
comodel_name='account.journal',
|
||||
string='Filter journals',
|
||||
@@ -156,12 +163,14 @@ class GeneralLedgerReportWizard(models.TransientModel):
|
||||
'date_from': self.date_from,
|
||||
'date_to': self.date_to,
|
||||
'only_posted_moves': self.target_move == 'posted',
|
||||
'hide_account_balance_at_0': self.hide_account_balance_at_0,
|
||||
'hide_account_at_0': self.hide_account_at_0,
|
||||
'foreign_currency': self.foreign_currency,
|
||||
'show_analytic_tags': self.show_analytic_tags,
|
||||
'company_id': self.company_id.id,
|
||||
'filter_account_ids': [(6, 0, self.account_ids.ids)],
|
||||
'filter_partner_ids': [(6, 0, self.partner_ids.ids)],
|
||||
'filter_cost_center_ids': [(6, 0, self.cost_center_ids.ids)],
|
||||
'filter_analytic_tag_ids': [(6, 0, self.analytic_tag_ids.ids)],
|
||||
'filter_journal_ids': [(6, 0, self.account_journal_ids.ids)],
|
||||
'centralize': self.centralize,
|
||||
'fy_start_date': self.fy_start_date,
|
||||
|
||||
@@ -21,24 +21,29 @@
|
||||
<group name="other_filters">
|
||||
<field name="target_move" widget="radio"/>
|
||||
<field name="centralize"/>
|
||||
<field name="hide_account_balance_at_0"/>
|
||||
<field name="hide_account_at_0"/>
|
||||
<field name="foreign_currency"/>
|
||||
<field name="show_analytic_tags"/>
|
||||
</group>
|
||||
</group>
|
||||
<label for="cost_center_ids" groups="analytic.group_analytic_accounting"/>
|
||||
<field name="cost_center_ids" nolabel="1" options="{'no_create': True}" groups="analytic.group_analytic_accounting"/>
|
||||
<group/>
|
||||
<label for="partner_ids"/>
|
||||
<field name="partner_ids" nolabel="1" options="{'no_create': True}"/>
|
||||
<label for="account_journal_ids"/>
|
||||
<field name="account_journal_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/>
|
||||
<group/>
|
||||
<label for="account_ids"/>
|
||||
<group col="4">
|
||||
<field name="receivable_accounts_only"/>
|
||||
<field name="payable_accounts_only"/>
|
||||
</group>
|
||||
<field name="account_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/>
|
||||
<notebook>
|
||||
<page string="Filter accounts">
|
||||
<group col="4">
|
||||
<field name="receivable_accounts_only"/>
|
||||
<field name="payable_accounts_only"/>
|
||||
</group>
|
||||
<field name="account_ids" nolabel="1" options="{'no_create': True}"/>
|
||||
</page>
|
||||
<page string="Filter partners">
|
||||
<field name="partner_ids" nolabel="1" options="{'no_create': True}"/>
|
||||
</page>
|
||||
<page string="Filter cost centers" groups="analytic.group_analytic_accounting">
|
||||
<field name="cost_center_ids" nolabel="1" options="{'no_create': True}" groups="analytic.group_analytic_accounting"/>
|
||||
</page>
|
||||
<page string="Filter analytic tags">
|
||||
<field name="analytic_tag_ids" nolabel="1" options="{'no_create': True}"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</div>
|
||||
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}">
|
||||
<field name="not_only_one_unaffected_earnings_account" invisible="1"/>
|
||||
|
||||
@@ -38,7 +38,7 @@ class JournalLedgerReportWizard(models.TransientModel):
|
||||
comodel_name='account.journal',
|
||||
string="Journals",
|
||||
domain="[('company_id', '=', company_id)]",
|
||||
required=True,
|
||||
required=False,
|
||||
)
|
||||
move_target = fields.Selection(
|
||||
selection='_get_move_targets',
|
||||
@@ -121,13 +121,18 @@ class JournalLedgerReportWizard(models.TransientModel):
|
||||
@api.multi
|
||||
def _prepare_report_journal_ledger(self):
|
||||
self.ensure_one()
|
||||
journals = self.journal_ids
|
||||
if not journals:
|
||||
# Not selecting a journal means that we'll display all journals
|
||||
journals = self.env['account.journal'].search(
|
||||
[('company_id', '=', self.company_id.id)])
|
||||
return {
|
||||
'date_from': self.date_from,
|
||||
'date_to': self.date_to,
|
||||
'move_target': self.move_target,
|
||||
'foreign_currency': self.foreign_currency,
|
||||
'company_id': self.company_id.id,
|
||||
'journal_ids': [(6, 0, self.journal_ids.ids)],
|
||||
'journal_ids': [(6, 0, journals.ids)],
|
||||
'sort_option': self.sort_option,
|
||||
'group_option': self.group_option,
|
||||
'with_account_name': self.with_account_name,
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
# Copyright 2016 Camptocamp SA
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from datetime import datetime
|
||||
from odoo import models, fields, api
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
from odoo.tools import pycompat
|
||||
@@ -21,7 +20,7 @@ class OpenItemsReportWizard(models.TransientModel):
|
||||
string='Company'
|
||||
)
|
||||
date_at = fields.Date(required=True,
|
||||
default=fields.Date.to_string(datetime.today()))
|
||||
default=fields.Date.context_today)
|
||||
target_move = fields.Selection([('posted', 'All Posted Entries'),
|
||||
('all', 'All Entries')],
|
||||
string='Target Moves',
|
||||
@@ -32,8 +31,8 @@ class OpenItemsReportWizard(models.TransientModel):
|
||||
string='Filter accounts',
|
||||
domain=[('reconcile', '=', True)],
|
||||
)
|
||||
hide_account_balance_at_0 = fields.Boolean(
|
||||
string='Hide account ending balance at 0',
|
||||
hide_account_at_0 = fields.Boolean(
|
||||
string='Hide account ending balance at 0', default=True,
|
||||
help='Use this filter to hide an account or a partner '
|
||||
'with an ending balance at 0. '
|
||||
'If partners are filtered, '
|
||||
@@ -102,7 +101,7 @@ class OpenItemsReportWizard(models.TransientModel):
|
||||
return {
|
||||
'date_at': self.date_at,
|
||||
'only_posted_moves': self.target_move == 'posted',
|
||||
'hide_account_balance_at_0': self.hide_account_balance_at_0,
|
||||
'hide_account_at_0': self.hide_account_at_0,
|
||||
'foreign_currency': self.foreign_currency,
|
||||
'company_id': self.company_id.id,
|
||||
'filter_account_ids': [(6, 0, self.account_ids.ids)],
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</group>
|
||||
<group name="other_filters">
|
||||
<field name="target_move" widget="radio"/>
|
||||
<field name="hide_account_balance_at_0"/>
|
||||
<field name="hide_account_at_0"/>
|
||||
<field name="foreign_currency"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
# Author: Julien Coux
|
||||
# Copyright 2016 Camptocamp SA
|
||||
# Copyright 2017 Akretion - Alexis de Lattre
|
||||
# Copyright 2018 Eficent Business and IT Consuting Services, S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import models, fields, api
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
from odoo.tools import pycompat
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class TrialBalanceReportWizard(models.TransientModel):
|
||||
@@ -44,6 +46,9 @@ class TrialBalanceReportWizard(models.TransientModel):
|
||||
No hierarchy: Use to display just the accounts, without any grouping.
|
||||
""",
|
||||
)
|
||||
limit_hierarchy_level = fields.Boolean('Limit hierarchy levels')
|
||||
show_hierarchy_level = fields.Integer('Hierarchy Levels to display',
|
||||
default=1)
|
||||
account_ids = fields.Many2many(
|
||||
comodel_name='account.account',
|
||||
string='Filter accounts',
|
||||
@@ -77,6 +82,14 @@ class TrialBalanceReportWizard(models.TransientModel):
|
||||
'will display initial and final balance in that currency.'
|
||||
)
|
||||
|
||||
@api.multi
|
||||
@api.constrains('hierarchy_on', 'show_hierarchy_level')
|
||||
def _check_show_hierarchy_level(self):
|
||||
for rec in self:
|
||||
if rec.hierarchy_on != 'none' and rec.show_hierarchy_level <= 0:
|
||||
raise UserError(_('The hierarchy level to filter on must be '
|
||||
'greater than 0.'))
|
||||
|
||||
@api.depends('date_from')
|
||||
def _compute_fy_start_date(self):
|
||||
for wiz in self.filtered('date_from'):
|
||||
@@ -168,6 +181,8 @@ class TrialBalanceReportWizard(models.TransientModel):
|
||||
'filter_journal_ids': [(6, 0, self.journal_ids.ids)],
|
||||
'fy_start_date': self.fy_start_date,
|
||||
'hierarchy_on': self.hierarchy_on,
|
||||
'limit_hierarchy_level': self.limit_hierarchy_level,
|
||||
'show_hierarchy_level': self.show_hierarchy_level,
|
||||
'show_partner_details': self.show_partner_details,
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
<field name="hide_account_at_0"/>
|
||||
<field name="show_partner_details"/>
|
||||
<field name="hierarchy_on" widget="radio" attrs="{'invisible':[('show_partner_details','=',True)]}"/>
|
||||
<field name="limit_hierarchy_level" attrs="{'invisible':['|', ('hierarchy_on','=','none'),('show_partner_details','=',True)]}"/>
|
||||
<field name="show_hierarchy_level" attrs="{'invisible':[('limit_hierarchy_level','=', False)]}"/>
|
||||
<field name="foreign_currency"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -31,6 +33,7 @@
|
||||
<label for="journal_ids"/>
|
||||
<field name="journal_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/>
|
||||
<group attrs="{'invisible':[('show_partner_details','!=',True)]}"/>
|
||||
<div/>
|
||||
<label for="account_ids"/>
|
||||
<group col="4">
|
||||
<field name="receivable_accounts_only"/>
|
||||
|
||||
Reference in New Issue
Block a user