Browse Source

Update links in report, add account group file, update trial balance with hierarchy.

Update indentation, remove empty lines from header.

Update test.

Update pylint.

Remove company_id on computing accounts, since account.group is not a company based model, filtering accounts is done on trial balance report.

Update account variables.

Improve condition in padding on accounts.

Add option to print hierarchy based on defined accounts/computed accounts.

Add VAT report, hierarchy from tax tags ans taxes.

Fix pylint, xlsx report generation header.

Update code to select code_prefix or name.

Update code to select code_prefix or name.

Update code to select code_prefix or name.

Fix domain in base amounts in vat report.

Change trial balance code_prefix or name.

Update trail balance, add tests for vat report.

Update pylint, amounts as monetary, many2one option on generation excels.

Update pulint.

Add VAT Report in readme.

Add VAT Report in readme.

Update array_agg.

Update array_agg.

Update array_agg.

Add option in VAT Report to be printed on Tax Tags - Tax Groups.

Add widget to hierarchy_on on trial balance.
pull/559/head
Fekete Mihai 7 years ago
committed by Pedro M. Baeza
parent
commit
c75ed98250
  1. 2
      account_financial_report/README.rst
  2. 6
      account_financial_report/__manifest__.py
  3. 7
      account_financial_report/menuitems.xml
  4. 6
      account_financial_report/models/__init__.py
  5. 1
      account_financial_report/models/account.py
  6. 48
      account_financial_report/models/account_group.py
  7. 3
      account_financial_report/report/__init__.py
  8. 5
      account_financial_report/report/abstract_report_xlsx.py
  9. 4
      account_financial_report/report/aged_partner_balance.py
  10. 119
      account_financial_report/report/aged_partner_balance_xlsx.py
  11. 15
      account_financial_report/report/general_ledger.py
  12. 13
      account_financial_report/report/general_ledger_xlsx.py
  13. 10
      account_financial_report/report/open_items.py
  14. 10
      account_financial_report/report/open_items_xlsx.py
  15. 300
      account_financial_report/report/templates/aged_partner_balance.xml
  16. 241
      account_financial_report/report/templates/general_ledger.xml
  17. 38
      account_financial_report/report/templates/open_items.xml
  18. 337
      account_financial_report/report/templates/trial_balance.xml
  19. 169
      account_financial_report/report/templates/vat_report.xml
  20. 263
      account_financial_report/report/trial_balance.py
  21. 9
      account_financial_report/report/trial_balance_xlsx.py
  22. 351
      account_financial_report/report/vat_report.py
  23. 51
      account_financial_report/report/vat_report_xlsx.py
  24. 32
      account_financial_report/reports.xml
  25. 8
      account_financial_report/static/src/js/account_financial_report_backend.js
  26. 19
      account_financial_report/static/src/js/account_financial_report_widgets.js
  27. 2
      account_financial_report/tests/__init__.py
  28. 4
      account_financial_report/tests/abstract_test.py
  29. 75
      account_financial_report/tests/abstract_test_tax_report.py
  30. 1
      account_financial_report/tests/test_aged_partner_balance.py
  31. 20
      account_financial_report/tests/test_general_ledger.py
  32. 1
      account_financial_report/tests/test_open_items.py
  33. 440
      account_financial_report/tests/test_trial_balance.py
  34. 288
      account_financial_report/tests/test_vat_report.py
  35. 28
      account_financial_report/view/account_view.xml
  36. 6
      account_financial_report/view/report_template.xml
  37. 4
      account_financial_report/view/report_trial_balance.xml
  38. 9
      account_financial_report/view/report_vat_report.xml
  39. 6
      account_financial_report/wizard/__init__.py
  40. 1
      account_financial_report/wizard/open_items_wizard.py
  41. 9
      account_financial_report/wizard/trial_balance_wizard.py
  42. 1
      account_financial_report/wizard/trial_balance_wizard_view.xml
  43. 80
      account_financial_report/wizard/vat_report_wizard.py
  44. 44
      account_financial_report/wizard/vat_report_wizard_view.xml

2
account_financial_report/README.rst

@ -13,6 +13,7 @@ Accounting / Reporting / OCA Reports.
- Trial Balance
- Open Items
- Aged Partner Balance
- VAT Report
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
@ -52,6 +53,7 @@ Contributors
* Julien Coux <julien.coux@camptocamp.com>
* Akim Juillerat <akim.juillerat@camptocamp.com>
* Alexis de Lattre <alexis@via.ecp.fr>
* Mihai Fekete <feketemihai@gmail.com>
Much of the work in this module was done at a sprint in Sorrento, Italy in
April 2016.

6
account_financial_report/__manifest__.py

@ -1,11 +1,10 @@
# Author: Damien Crier
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Account Financial Reports',
'version': '11.0.1.2.0',
'version': '11.0.2.0.0',
'category': 'Reporting',
'summary': 'OCA Financial Reports',
'author': 'Camptocamp SA,'
@ -24,6 +23,7 @@
'wizard/general_ledger_wizard_view.xml',
'wizard/open_items_wizard_view.xml',
'wizard/trial_balance_wizard_view.xml',
'wizard/vat_report_wizard_view.xml',
'menuitems.xml',
'reports.xml',
'report/templates/layouts.xml',
@ -31,12 +31,14 @@
'report/templates/general_ledger.xml',
'report/templates/open_items.xml',
'report/templates/trial_balance.xml',
'report/templates/vat_report.xml',
'view/account_view.xml',
'view/report_template.xml',
'view/report_general_ledger.xml',
'view/report_trial_balance.xml',
'view/report_open_items.xml',
'view/report_aged_partner_balance.xml',
'view/report_vat_report.xml',
],
'installable': True,
'application': True,

7
account_financial_report/menuitems.xml

@ -35,6 +35,13 @@
id="menu_aged_partner_balance_wizard"
sequence="40"
/>
<menuitem
parent="menu_oca_reports"
action="action_vat_report_wizard"
id="menu_vat_report_wizard"
sequence="50"
/>
<!-- Hide odoo PDF reports menu -->
<menuitem

6
account_financial_report/models/__init__.py

@ -1,6 +1,2 @@
# Author: Damien Crier
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import account
from . import account_group

1
account_financial_report/models/account.py

@ -1,4 +1,3 @@
# © 2011 Guewen Baconnier (Camptocamp)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
from odoo import models, fields

48
account_financial_report/models/account_group.py

@ -0,0 +1,48 @@
# © 2018 Forest and Biomass Romania SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class AccountGroup(models.Model):
_inherit = 'account.group'
group_child_ids = fields.One2many(
comodel_name='account.group',
inverse_name='parent_id',
string='Child Groups')
level = fields.Integer(
string='Level',
compute='_compute_level',
store=True)
account_ids = fields.One2many(
comodel_name='account.account',
inverse_name='group_id',
string="Accounts")
compute_account_ids = fields.Many2many(
'account.account',
compute='_compute_group_accounts',
string="Accounts", store=True)
@api.multi
@api.depends('parent_id')
def _compute_level(self):
for group in self:
level = 0
new_group = group
while new_group.parent_id:
level += 1
new_group = new_group.parent_id
group.level = level
@api.multi
@api.depends('code_prefix', 'account_ids', 'account_ids.code',
'group_child_ids', 'group_child_ids.account_ids.code')
def _compute_group_accounts(self):
account_obj = self.env['account.account']
accounts = account_obj.search([])
for group in self:
prefix = group.code_prefix if group.code_prefix else group.name
gr_acc = accounts.filtered(
lambda a: a.code.startswith(prefix)).ids
group.compute_account_ids = [(6, 0, gr_acc)]

3
account_financial_report/report/__init__.py

@ -1,4 +1,3 @@
# © 2015 Yannick Vaucher (Camptocamp)
# © 2016 Damien Crier (Camptocamp)
# © 2016 Julien Coux (Camptocamp)
@ -13,3 +12,5 @@ from . import open_items
from . import open_items_xlsx
from . import trial_balance
from . import trial_balance_xlsx
from . import vat_report
from . import vat_report_xlsx

5
account_financial_report/report/abstract_report_xlsx.py

@ -166,7 +166,10 @@ class AbstractReportXslx(models.AbstractModel):
for col_pos, column in self.columns.items():
value = getattr(line_object, column['field'])
cell_type = column.get('type', 'string')
if cell_type == 'string':
if cell_type == 'many2one':
self.sheet.write_string(
self.row_pos, col_pos, value.name or '')
elif cell_type == 'string':
self.sheet.write_string(self.row_pos, col_pos, value or '')
elif cell_type == 'amount':
self.sheet.write_number(

4
account_financial_report/report/aged_partner_balance.py

@ -201,7 +201,7 @@ class AgedPartnerBalanceReportCompute(models.TransientModel):
rcontext['o'] = report
result['html'] = self.env.ref(
'account_financial_report.report_aged_partner_balance').render(
rcontext)
rcontext)
return result
@api.model
@ -450,6 +450,7 @@ INSERT INTO
report_partner_id,
create_uid,
create_date,
move_line_id,
date,
date_due,
entry,
@ -469,6 +470,7 @@ SELECT
rp.id AS report_partner_id,
%s AS create_uid,
NOW() AS create_date,
rlo.move_line_id,
rlo.date,
rlo.date_due,
rlo.entry,

119
account_financial_report/report/aged_partner_balance_xlsx.py

@ -59,71 +59,70 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
'type': 'amount',
'width': 14},
}
else:
return {
0: {'header': _('Date'), 'field': 'date', 'width': 11},
1: {'header': _('Entry'), 'field': 'entry', 'width': 18},
2: {'header': _('Journal'), 'field': 'journal', 'width': 8},
3: {'header': _('Account'), 'field': 'account', 'width': 9},
4: {'header': _('Partner'), 'field': 'partner', 'width': 25},
5: {'header': _('Ref - Label'), 'field': 'label', 'width': 40},
6: {'header': _('Due date'), 'field': 'date_due', 'width': 11},
7: {'header': _('Residual'),
'field': 'amount_residual',
'field_footer_total': 'cumul_amount_residual',
'field_final_balance': 'amount_residual',
'type': 'amount',
'width': 14},
8: {'header': _('Current'),
'field': 'current',
'field_footer_total': 'cumul_current',
'field_footer_percent': 'percent_current',
'field_final_balance': 'current',
'type': 'amount',
'width': 14},
9: {'header': _(u'Age ≤ 30 d.'),
'field': 'age_30_days',
'field_footer_total': 'cumul_age_30_days',
'field_footer_percent': 'percent_age_30_days',
'field_final_balance': 'age_30_days',
'type': 'amount',
'width': 14},
10: {'header': _(u'Age ≤ 60 d.'),
'field': 'age_60_days',
'field_footer_total': 'cumul_age_60_days',
'field_footer_percent': 'percent_age_60_days',
'field_final_balance': 'age_60_days',
'type': 'amount',
'width': 14},
11: {'header': _(u'Age ≤ 90 d.'),
'field': 'age_90_days',
'field_footer_total': 'cumul_age_90_days',
'field_footer_percent': 'percent_age_90_days',
'field_final_balance': 'age_90_days',
'type': 'amount',
'width': 14},
12: {'header': _(u'Age ≤ 120 d.'),
'field': 'age_120_days',
'field_footer_total': 'cumul_age_120_days',
'field_footer_percent': 'percent_age_120_days',
'field_final_balance': 'age_120_days',
'type': 'amount',
'width': 14},
13: {'header': _('Older'),
'field': 'older',
'field_footer_total': 'cumul_older',
'field_footer_percent': 'percent_older',
'field_final_balance': 'older',
'type': 'amount',
'width': 14},
}
return {
0: {'header': _('Date'), 'field': 'date', 'width': 11},
1: {'header': _('Entry'), 'field': 'entry', 'width': 18},
2: {'header': _('Journal'), 'field': 'journal', 'width': 8},
3: {'header': _('Account'), 'field': 'account', 'width': 9},
4: {'header': _('Partner'), 'field': 'partner', 'width': 25},
5: {'header': _('Ref - Label'), 'field': 'label', 'width': 40},
6: {'header': _('Due date'), 'field': 'date_due', 'width': 11},
7: {'header': _('Residual'),
'field': 'amount_residual',
'field_footer_total': 'cumul_amount_residual',
'field_final_balance': 'amount_residual',
'type': 'amount',
'width': 14},
8: {'header': _('Current'),
'field': 'current',
'field_footer_total': 'cumul_current',
'field_footer_percent': 'percent_current',
'field_final_balance': 'current',
'type': 'amount',
'width': 14},
9: {'header': _(u'Age ≤ 30 d.'),
'field': 'age_30_days',
'field_footer_total': 'cumul_age_30_days',
'field_footer_percent': 'percent_age_30_days',
'field_final_balance': 'age_30_days',
'type': 'amount',
'width': 14},
10: {'header': _(u'Age ≤ 60 d.'),
'field': 'age_60_days',
'field_footer_total': 'cumul_age_60_days',
'field_footer_percent': 'percent_age_60_days',
'field_final_balance': 'age_60_days',
'type': 'amount',
'width': 14},
11: {'header': _(u'Age ≤ 90 d.'),
'field': 'age_90_days',
'field_footer_total': 'cumul_age_90_days',
'field_footer_percent': 'percent_age_90_days',
'field_final_balance': 'age_90_days',
'type': 'amount',
'width': 14},
12: {'header': _(u'Age ≤ 120 d.'),
'field': 'age_120_days',
'field_footer_total': 'cumul_age_120_days',
'field_footer_percent': 'percent_age_120_days',
'field_final_balance': 'age_120_days',
'type': 'amount',
'width': 14},
13: {'header': _('Older'),
'field': 'older',
'field_footer_total': 'cumul_older',
'field_footer_percent': 'percent_older',
'field_final_balance': 'older',
'type': 'amount',
'width': 14},
}
def _get_report_filters(self, report):
return [
[_('Date at filter'), report.date_at],
[_('Target moves filter'),
_('All posted entries') if report.only_posted_moves
else _('All entries')],
_('All posted entries') if report.only_posted_moves else _(
'All entries')],
]
def _get_col_count_filter_name(self):

15
account_financial_report/report/general_ledger.py

@ -184,7 +184,7 @@ class GeneralLedgerReportMoveLine(models.TransientModel):
debit = fields.Float(digits=(16, 2))
credit = fields.Float(digits=(16, 2))
cumul_balance = fields.Float(digits=(16, 2))
currency_name = fields.Char()
currency_id = fields.Many2one('res.currency')
amount_currency = fields.Float(digits=(16, 2))
@ -216,7 +216,7 @@ class GeneralLedgerReportCompute(models.TransientModel):
rcontext['o'] = report
result['html'] = self.env.ref(
'account_financial_report.report_general_ledger').render(
rcontext)
rcontext)
return result
@api.model
@ -226,8 +226,7 @@ class GeneralLedgerReportCompute(models.TransientModel):
@api.multi
def compute_data_for_report(self,
with_line_details=True,
with_partners=True
):
with_partners=True):
self.ensure_one()
# Compute report data
self._inject_account_values()
@ -884,7 +883,7 @@ INSERT INTO
debit,
credit,
cumul_balance,
currency_name,
currency_id,
amount_currency
)
SELECT
@ -952,7 +951,7 @@ SELECT
) AS cumul_balance,
"""
query_inject_move_line += """
c.name AS currency_name,
c.id AS currency_id,
ml.amount_currency
FROM
"""
@ -1213,7 +1212,7 @@ SET
ON l.report_account_id = a.id
WHERE
a.report_id = %s
AND l.currency_name IS NOT NULL
AND l.currency_id IS NOT NULL
LIMIT 1
)
OR
@ -1230,7 +1229,7 @@ SET
ON p.report_account_id = a.id
WHERE
a.report_id = %s
AND l.currency_name IS NOT NULL
AND l.currency_id IS NOT NULL
LIMIT 1
)
WHERE id = %s

13
account_financial_report/report/general_ledger_xlsx.py

@ -44,7 +44,8 @@ class GeneralLedgerXslx(models.AbstractModel):
'field_final_balance': 'final_balance',
'type': 'amount',
'width': 14},
11: {'header': _('Cur.'), 'field': 'currency_name', 'width': 7},
11: {'header': _('Cur.'), 'field': 'currency_id',
'type': 'many2one', 'width': 7},
12: {'header': _('Amount cur.'),
'field': 'amount_currency',
'type': 'amount',
@ -54,14 +55,14 @@ class GeneralLedgerXslx(models.AbstractModel):
def _get_report_filters(self, report):
return [
[_('Date range filter'),
_('From: %s To: %s') % (report.date_from, report.date_to)],
_('From: %s To: %s') % (report.date_from, report.date_to)],
[_('Target moves filter'),
_('All posted entries') if report.only_posted_moves
else _('All entries')],
_('All posted entries') if report.only_posted_moves else _(
'All entries')],
[_('Account balance at 0 filter'),
_('Hide') if report.hide_account_balance_at_0 else _('Show')],
_('Hide') if report.hide_account_balance_at_0 else _('Show')],
[_('Centralize filter'),
_('Yes') if report.centralize else _('No')],
_('Yes') if report.centralize else _('No')],
]
def _get_col_count_filter_name(self):

10
account_financial_report/report/open_items.py

@ -128,7 +128,7 @@ class OpenItemsReportMoveLine(models.TransientModel):
label = fields.Char()
amount_total_due = fields.Float(digits=(16, 2))
amount_residual = fields.Float(digits=(16, 2))
currency_name = fields.Char()
currency_id = fields.Many2one('res.currency')
amount_total_due_currency = fields.Float(digits=(16, 2))
amount_residual_currency = fields.Float(digits=(16, 2))
@ -161,7 +161,7 @@ class OpenItemsReportCompute(models.TransientModel):
rcontext['o'] = report
result['html'] = self.env.ref(
'account_financial_report.report_open_items').render(
rcontext)
rcontext)
return result
@api.model
@ -512,7 +512,7 @@ INSERT INTO
label,
amount_total_due,
amount_residual,
currency_name,
currency_id,
amount_total_due_currency,
amount_residual_currency
)
@ -545,7 +545,7 @@ SELECT
CONCAT_WS(' - ', NULLIF(ml.ref, ''), NULLIF(ml.name, '')) AS label,
ml.balance,
ml2.amount_residual,
c.name AS currency_name,
c.id AS currency_id,
ml.amount_currency,
ml2.amount_residual_currency
FROM
@ -767,7 +767,7 @@ SET
ON p.report_account_id = a.id
WHERE
a.report_id = %s
AND l.currency_name IS NOT NULL
AND l.currency_id IS NOT NULL
LIMIT 1
)
WHERE id = %s

10
account_financial_report/report/open_items_xlsx.py

@ -1,4 +1,3 @@
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
@ -31,7 +30,8 @@ class OpenItemsXslx(models.AbstractModel):
'field_final_balance': 'final_amount_residual',
'type': 'amount',
'width': 14},
9: {'header': _('Cur.'), 'field': 'currency_name', 'width': 7},
9: {'header': _('Cur.'), 'field': 'currency_id',
'type': 'many2one', 'width': 7},
10: {'header': _('Cur. Original'),
'field': 'amount_total_due_currency',
'type': 'amount',
@ -46,10 +46,10 @@ class OpenItemsXslx(models.AbstractModel):
return [
[_('Date at filter'), report.date_at],
[_('Target moves filter'),
_('All posted entries') if report.only_posted_moves
else _('All entries')],
_('All posted entries') if report.only_posted_moves else _(
'All entries')],
[_('Account balance at 0 filter'),
_('Hide') if report.hide_account_balance_at_0 else _('Show')],
_('Hide') if report.hide_account_balance_at_0 else _('Show')],
]
def _get_col_count_filter_name(self):

300
account_financial_report/report/templates/aged_partner_balance.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="account_financial_report.report_aged_partner_balance_qweb">
<template id="report_aged_partner_balance_qweb">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="account_financial_report.internal_layout">
@ -11,7 +11,7 @@
</t>
</template>
<template id="account_financial_report.report_aged_partner_balance_base">
<template id="report_aged_partner_balance_base">
<!-- Saved flag fields into variables, used to define columns display -->
<t t-set="show_move_line_details" t-value="o.show_move_line_details"/>
@ -81,7 +81,7 @@
</div>
</template>
<template id="account_financial_report.report_aged_partner_balance_filters">
<template id="report_aged_partner_balance_filters">
<div class="act_as_table data_table" style="width: 100%;">
<div class="act_as_row labels">
<div class="act_as_cell">Date at filter</div>
@ -99,7 +99,7 @@
</div>
</template>
<template id="account_financial_report.report_aged_partner_balance_lines_header">
<template id="report_aged_partner_balance_lines_header">
<!-- Display table headers for lines -->
<div class="act_as_thead">
<div class="act_as_row labels">
@ -123,7 +123,7 @@
</div>
</template>
<template id="account_financial_report.report_aged_partner_balance_lines">
<template id="report_aged_partner_balance_lines">
<!-- Display each lines -->
<t t-foreach="partner.line_ids" t-as="line">
<!-- # lines -->
@ -134,78 +134,78 @@
</div>
<!--## amount_residual-->
<div class="act_as_cell amount">
<span t-field="line.amount_residual"/>
<span t-field="line.amount_residual" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## current-->
<div class="act_as_cell amount">
<span t-field="line.current"/>
<span t-field="line.current" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_30_days-->
<div class="act_as_cell amount">
<span t-field="line.age_30_days"/>
<span t-field="line.age_30_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_60_days-->
<div class="act_as_cell amount">
<span t-field="line.age_60_days"/>
<span t-field="line.age_60_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_90_days-->
<div class="act_as_cell amount">
<span t-field="line.age_90_days"/>
<span t-field="line.age_90_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_120_days-->
<div class="act_as_cell amount">
<span t-field="line.age_120_days"/>
<span t-field="line.age_120_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## older-->
<div class="act_as_cell amount">
<span t-field="line.older"/>
<span t-field="line.older" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
</div>
</t>
</template>
<template id="account_financial_report.report_aged_partner_balance_move_lines">
<template id="report_aged_partner_balance_move_lines">
<div class="act_as_table data_table" style="width: 100%;">
<!-- Display table headers for move lines -->
<div class="act_as_thead">
<div class="act_as_row labels">
<!--## date-->
<div class="act_as_cell first_column" style="width: 5.26%;">
<div class="act_as_cell first_column" style="width: 6.00%;">
Date</div>
<!--## move-->
<div class="act_as_cell" style="width: 8.77%;">Entry</div>
<div class="act_as_cell" style="width: 7.00%;">Entry</div>
<!--## journal-->
<div class="act_as_cell" style="width: 5.01%;">Journal</div>
<div class="act_as_cell" style="width: 5.00%;">Journal</div>
<!--## account code-->
<div class="act_as_cell" style="width: 6.88%;">Account</div>
<div class="act_as_cell" style="width: 6.00%;">Account</div>
<!--## partner-->
<div class="act_as_cell" style="width: 10.52%;">Partner
<div class="act_as_cell" style="width: 10.50%;">Partner
</div>
<!--## ref - label-->
<div class="act_as_cell" style="width: 19.23%;">Ref -
<div class="act_as_cell" style="width: 18.00%;">Ref -
Label</div>
<!--## date_due-->
<div class="act_as_cell" style="width: 6.26%;">Due
<div class="act_as_cell" style="width: 6.00%;">Due
date</div>
<!--## amount_residual-->
<div class="act_as_cell" style="width: 6.19%;">Residual
<div class="act_as_cell" style="width: 6.00%;">Residual
</div>
<!--## current-->
<div class="act_as_cell" style="width: 6.19%;">Current</div>
<div class="act_as_cell" style="width: 6.00%;">Current</div>
<!--## age_30_days-->
<div class="act_as_cell" style="width: 6.19%;">Age ≤ 30
<div class="act_as_cell" style="width: 6.00%;">Age ≤ 30
d.</div>
<!--## age_60_days-->
<div class="act_as_cell" style="width: 6.19%;">Age ≤ 60
<div class="act_as_cell" style="width: 6.00%;">Age ≤ 60
d.</div>
<!--## age_90_days-->
<div class="act_as_cell" style="width: 6.19%;">Age ≤ 90
<div class="act_as_cell" style="width: 6.00%;">Age ≤ 90
d.</div>
<!--## age_120_days-->
<div class="act_as_cell" style="width: 6.19%;">Age ≤ 120
<div class="act_as_cell" style="width: 6.00%;">Age ≤ 120
d.</div>
<!--## older-->
<div class="act_as_cell" style="width: 6.19%;">Older</div>
<div class="act_as_cell" style="width: 6.00%;">Older</div>
</div>
</div>
<!-- Display each move lines -->
@ -214,174 +214,288 @@
<div class="act_as_row lines">
<!--## date-->
<div class="act_as_cell left">
<span t-field="line.date"/>
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.date"/></a>
</span>
</div>
<!--## move-->
<div class="act_as_cell left">
<span t-field="line.entry"/>
<span>
<a t-att-data-active-id="line.move_line_id.move_id.id"
t-att-data-res-model="'account.move'"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.entry"/></a>
</span>
</div>
<!--## journal-->
<div class="act_as_cell left">
<span t-field="line.journal"/>
<span>
<a t-att-data-active-id="line.move_line_id.move_id.journal_id.id"
t-att-data-res-model="'account.journal'"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.journal"/></a>
</span>
</div>
<!--## account code-->
<div class="act_as_cell left">
<span t-field="line.account"/>
<span>
<a t-att-data-active-id="line.move_line_id.account_id.id"
t-att-data-res-model="'account.account'"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.account"/></a>
</span>
</div>
<!--## partner-->
<div class="act_as_cell left">
<span t-field="line.partner"/>
<span>
<a t-att-data-active-id="line.move_line_id.partner_id.id"
t-att-data-res-model="'res.partner'"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.partner"/></a>
</span>
</div>
<!--## ref - label-->
<div class="act_as_cell left">
<span t-field="line.label"/>
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.label"/></a>
</span>
</div>
<!--## date_due-->
<div class="act_as_cell left">
<span t-field="line.date_due"/>
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.date_due"/></a>
</span>
</div>
<!--## amount_residual-->
<div class="act_as_cell amount">
<span t-field="line.amount_residual"/>
<span>
<a t-att-data-domain="[('id', 'in', list(filter(lambda x: x != 'False', [str(line.move_line_id.id), str(line.move_line_id.matched_debit_ids.debit_move_id.id), str(line.move_line_id.matched_credit_ids.credit_move_id.id)])))]"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
style="color: black;">
<t t-raw="line.amount_residual" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<!--## current-->
<div class="act_as_cell amount">
<span t-field="line.current"/>
<t t-if="line.current != 0">
<span>
<a t-att-data-domain="[('id', 'in', list(filter(lambda x: x != 'False', [str(line.move_line_id.id), str(line.move_line_id.matched_debit_ids.debit_move_id.id), str(line.move_line_id.matched_credit_ids.credit_move_id.id)])))]"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
style="color: black;">
<t t-raw="line.current" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="line.current == 0">
<span t-field="line.current" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
</div>
<!--## age_30_days-->
<div class="act_as_cell amount">
<span t-field="line.age_30_days"/>
<t t-if="line.age_30_days != 0">
<span>
<a t-att-data-domain="[('id', 'in', list(filter(lambda x: x != 'False', [str(line.move_line_id.id), str(line.move_line_id.matched_debit_ids.debit_move_id.id), str(line.move_line_id.matched_credit_ids.credit_move_id.id)])))]"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
style="color: black;">
<t t-raw="line.age_30_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="line.age_30_days == 0">
<span t-field="line.age_30_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
</div>
<!--## age_60_days-->
<div class="act_as_cell amount">
<span t-field="line.age_60_days"/>
<t t-if="line.age_60_days != 0">
<span>
<a t-att-data-domain="[('id', 'in', list(filter(lambda x: x != 'False', [str(line.move_line_id.id), str(line.move_line_id.matched_debit_ids.debit_move_id.id), str(line.move_line_id.matched_credit_ids.credit_move_id.id)])))]"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
style="color: black;">
<t t-raw="line.age_60_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="line.age_60_days == 0">
<span t-field="line.age_60_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
</div>
<!--## age_90_days-->
<div class="act_as_cell amount">
<span t-field="line.age_90_days"/>
<t t-if="line.age_90_days != 0">
<span>
<a t-att-data-domain="[('id', 'in', list(filter(lambda x: x != 'False', [str(line.move_line_id.id), str(line.move_line_id.matched_debit_ids.debit_move_id.id), str(line.move_line_id.matched_credit_ids.credit_move_id.id)])))]"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
style="color: black;">
<t t-raw="line.age_90_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="line.age_90_days == 0">
<span t-field="line.age_90_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
</div>
<!--## age_120_days-->
<div class="act_as_cell amount">
<span t-field="line.age_120_days"/>
<t t-if="line.age_120_days != 0">
<span>
<a t-att-data-domain="[('id', 'in', list(filter(lambda x: x != 'False', [str(line.move_line_id.id), str(line.move_line_id.matched_debit_ids.debit_move_id.id), str(line.move_line_id.matched_credit_ids.credit_move_id.id)])))]"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
style="color: black;">
<t t-raw="line.age_120_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="line.age_120_days == 0">
<span t-field="line.age_120_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
</div>
<!--## older-->
<div class="act_as_cell amount">
<span t-field="line.older"/>
<t t-if="line.older != 0">
<span>
<a t-att-data-domain="[('id', 'in', list(filter(lambda x: x != 'False', [str(line.move_line_id.id), str(line.move_line_id.matched_debit_ids.debit_move_id.id), str(line.move_line_id.matched_credit_ids.credit_move_id.id)])))]"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
style="color: black;">
<t t-raw="line.older" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="line.older == 0">
<span t-field="line.older" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
</div>
</div>
</t>
</div>
</template>
<template id="account_financial_report.report_aged_partner_balance_partner_ending_cumul">
<template id="report_aged_partner_balance_partner_ending_cumul">
<!-- Display ending balance line for partner -->
<div class="act_as_table list_table" style="width: 100%;">
<div class="act_as_row labels" style="font-weight: bold;">
<div class="act_as_row lines" style="font-weight: bold;">
<!--## date-->
<div class="act_as_cell right" style="width: 51.41%;">Partner
<div class="act_as_cell right" style="width: 52.00%;">Partner
cumul aged balance</div>
<!--## date_due-->
<div class="act_as_cell" style="width: 5.26%;"/>
<div class="act_as_cell" style="width: 6.00%;"/>
<!--## amount_residual-->
<div class="act_as_cell amount" style="width: 6.19%;">
<span t-field="partner_cumul_line.amount_residual"/>
<div class="act_as_cell amount" style="width: 6.00%;">
<span t-field="partner_cumul_line.amount_residual" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## current-->
<div class="act_as_cell amount" style="width: 6.19%;">
<span t-field="partner_cumul_line.current"/>
<div class="act_as_cell amount" style="width: 6.00%;">
<span t-field="partner_cumul_line.current" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_30_days-->
<div class="act_as_cell amount" style="width: 6.19%;">
<span t-field="partner_cumul_line.age_30_days"/>
<div class="act_as_cell amount" style="width: 6.00%;">
<span t-field="partner_cumul_line.age_30_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_60_days-->
<div class="act_as_cell amount" style="width: 6.19%;">
<span t-field="partner_cumul_line.age_60_days"/>
<div class="act_as_cell amount" style="width: 6.00%;">
<span t-field="partner_cumul_line.age_60_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_90_days-->
<div class="act_as_cell amount" style="width: 6.19%;">
<span t-field="partner_cumul_line.age_90_days"/>
<div class="act_as_cell amount" style="width: 6.00%;">
<span t-field="partner_cumul_line.age_90_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_120_days-->
<div class="act_as_cell amount" style="width: 6.19%;">
<span t-field="partner_cumul_line.age_120_days"/>
<div class="act_as_cell amount" style="width: 6.00%;">
<span t-field="partner_cumul_line.age_120_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## older-->
<div class="act_as_cell amount" style="width: 6.19%;">
<span t-field="partner_cumul_line.older"/>
<div class="act_as_cell amount" style="width: 6.00%;">
<span t-field="partner_cumul_line.older" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
</div>
</div>
</template>
<template id="account_financial_report.report_aged_partner_balance_account_ending_cumul">
<template id="report_aged_partner_balance_account_ending_cumul">
<!-- Display ending balance line for account -->
<div class="act_as_table list_table" style="width: 100%;">
<div class="act_as_row labels" style="font-weight: bold;">
<div class="act_as_row lines" style="font-weight: bold;">
<t t-if="not show_move_line_details">
<!--## total-->
<div class="act_as_cell right" style="width: 32.52%;">Total</div>
<!--## amount_residual-->
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_amount_residual"/>
<span t-field="account.cumul_amount_residual" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## current-->
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_current"/>
<span t-field="account.cumul_current" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_30_days-->
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_age_30_days"/>
<span t-field="account.cumul_age_30_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_60_days-->
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_age_60_days"/>
<span t-field="account.cumul_age_60_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_90_days-->
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_age_90_days"/>
<span t-field="account.cumul_age_90_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_120_days-->
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_age_120_days"/>
<span t-field="account.cumul_age_120_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## older-->
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_older"/>
<span t-field="account.cumul_older" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
</t>
<t t-if="show_move_line_details">
<!--## total-->
<div class="act_as_cell right" style="width: 51.41%;">Total</div>
<div class="act_as_cell right" style="width: 52.00%;">Total</div>
<!--## date_due-->
<div class="act_as_cell" style="width: 5.26%;"/>
<div class="act_as_cell" style="width: 6.00%;"/>
<!--## amount_residual-->
<div class="act_as_cell amount" style="width: 6.19%">
<span t-field="account.cumul_amount_residual"/>
<div class="act_as_cell amount" style="width: 6.00%">
<span t-field="account.cumul_amount_residual" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## current-->
<div class="act_as_cell amount" style="width: 6.19%">
<span t-field="account.cumul_current"/>
<div class="act_as_cell amount" style="width: 6.00%">
<span t-field="account.cumul_current" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_30_days-->
<div class="act_as_cell amount" style="width: 6.19%">
<span t-field="account.cumul_age_30_days"/>
<div class="act_as_cell amount" style="width: 6.00%">
<span t-field="account.cumul_age_30_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_60_days-->
<div class="act_as_cell amount" style="width: 6.19%">
<span t-field="account.cumul_age_60_days"/>
<div class="act_as_cell amount" style="width: 6.00%">
<span t-field="account.cumul_age_60_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_90_days-->
<div class="act_as_cell amount" style="width: 6.19%">
<span t-field="account.cumul_age_90_days"/>
<div class="act_as_cell amount" style="width: 6.00%">
<span t-field="account.cumul_age_90_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_120_days-->
<div class="act_as_cell amount" style="width: 6.19%">
<span t-field="account.cumul_age_120_days"/>
<div class="act_as_cell amount" style="width: 6.00%">
<span t-field="account.cumul_age_120_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## older-->
<div class="act_as_cell amount" style="width: 6.19%">
<span t-field="account.cumul_older"/>
<div class="act_as_cell amount" style="width: 6.00%">
<span t-field="account.cumul_older" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
</t>
</div>
@ -414,29 +528,29 @@
</t>
<t t-if="show_move_line_details">
<!--## total-->
<div class="act_as_cell right" style="width: 51.41%;">
<div class="act_as_cell right" style="width: 52.00%;">
Percents</div>
<!--## date_due-->
<div class="act_as_cell" style="width: 5.26%;"/>
<div class="act_as_cell" style="width: 6.00%;"/>
<!--## amount_residual-->
<div class="act_as_cell amount" style="width: 6.19%"/>
<div class="act_as_cell amount" style="width: 6.00%"/>
<!--## current-->
<div class="act_as_cell amount" style="width: 6.19%"><span t-field="account.percent_current"/>%
<div class="act_as_cell amount" style="width: 6.00%"><span t-field="account.percent_current"/>%
</div>
<!--## age_30_days-->
<div class="act_as_cell amount" style="width: 6.19%"><span t-field="account.percent_age_30_days"/>%
<div class="act_as_cell amount" style="width: 6.00%"><span t-field="account.percent_age_30_days"/>%
</div>
<!--## age_60_days-->
<div class="act_as_cell amount" style="width: 6.19%"><span t-field="account.percent_age_60_days"/>%
<div class="act_as_cell amount" style="width: 6.00%"><span t-field="account.percent_age_60_days"/>%
</div>
<!--## age_90_days-->
<div class="act_as_cell amount" style="width: 6.19%"><span t-field="account.percent_age_90_days"/>%
<div class="act_as_cell amount" style="width: 6.00%"><span t-field="account.percent_age_90_days"/>%
</div>
<!--## age_120_days-->
<div class="act_as_cell amount" style="width: 6.19%"><span t-field="account.percent_age_120_days"/>%
<div class="act_as_cell amount" style="width: 6.00%"><span t-field="account.percent_age_120_days"/>%
</div>
<!--## older-->
<div class="act_as_cell amount" style="width: 6.19%"><span t-field="account.percent_older"/>%
<div class="act_as_cell amount" style="width: 6.00%"><span t-field="account.percent_older"/>%
</div>
</t>
</div>

241
account_financial_report/report/templates/general_ledger.xml

@ -34,6 +34,7 @@
<t t-if="not account.partner_ids">
<!-- Display account move lines without partner regroup -->
<t t-set="type" t-value='"account_type"'/>
<t t-call="account_financial_report.report_general_ledger_lines">
<t t-set="account_or_partner_object" t-value="account"/>
</t>
@ -42,6 +43,7 @@
<t t-if="account.partner_ids">
<!-- Display account partners -->
<t t-foreach="account.partner_ids" t-as="partner">
<t t-set="type" t-value='"partner_type"'/>
<div class="page_break">
<!-- Display partner header -->
<div class="act_as_caption account_title">
@ -116,7 +118,7 @@
<!--## account code-->
<div class="act_as_cell" style="width: 5.19%;">Account</div>
<!--## partner-->
<div class="act_as_cell" style="width: 10%;">Partner
<div class="act_as_cell" style="width: 13.11%;">Partner
</div>
<!--## ref - label-->
<div class="act_as_cell" style="width: 25%;">Ref -
@ -134,8 +136,6 @@
<div class="act_as_cell amount" style="width: 6.57%;">Credit</div>
<!--## balance cumulated-->
<div class="act_as_cell amount" style="width: 6.57%;">Cumul. Bal.</div>
<!--## currency_name-->
<div class="act_as_cell" style="width: 3.11%;">Cur.</div>
<!--## amount_currency-->
<div class="act_as_cell amount" style="width: 6.57%;">Amount cur.</div>
</div>
@ -162,13 +162,93 @@
<!--## matching_number-->
<div class="act_as_cell"/>
<!--## debit-->
<div class="act_as_cell amount"><span t-field="account_or_partner_object.initial_debit"/></div>
<div class="act_as_cell amount">
<t t-if="type == 'account_type'">
<t t-set="domain"
t-value="[('account_id', '=', account_or_partner_object.account_id.id),
('date', '&lt;', o.date_from),
('debit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
style="color: black;">
<t t-raw="account_or_partner_object.initial_debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', account_or_partner_object.report_account_id.account_id.id),
('partner_id', '=', account_or_partner_object.partner_id.id),
('date', '&lt;', o.date_from),
('debit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
style="color: black;">
<t t-raw="account_or_partner_object.initial_debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</div>
<!--## credit-->
<div class="act_as_cell amount"><span t-field="account_or_partner_object.initial_credit"/></div>
<div class="act_as_cell amount">
<t t-if="type == 'account_type'">
<t t-set="domain"
t-value="[('account_id', '=', account_or_partner_object.account_id.id),
('date', '&lt;', o.date_from),
('credit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
style="color: black;">
<t t-raw="account_or_partner_object.initial_credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', account_or_partner_object.report_account_id.account_id.id),
('partner_id', '=', account_or_partner_object.partner_id.id),
('date', '&lt;', o.date_from),
('credit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
style="color: black;">
<t t-raw="account_or_partner_object.initial_credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</div>
<!--## balance cumulated-->
<div class="act_as_cell amount"><span t-field="account_or_partner_object.initial_balance"/></div>
<!--## currency_name-->
<div class="act_as_cell"/>
<div class="act_as_cell amount">
<t t-if="type == 'account_type'">
<t t-set="domain"
t-value="[('account_id', '=', account_or_partner_object.account_id.id),
('date', '&lt;', o.date_from)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
style="color: black;">
<t t-raw="account_or_partner_object.initial_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', account_or_partner_object.report_account_id.account_id.id),
('partner_id', '=', account_or_partner_object.partner_id.id),
('date', '&lt;', o.date_from)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
style="color: black;">
<t t-raw="account_or_partner_object.initial_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</div>
<!--## amount_currency-->
<div class="act_as_cell"/>
</div>
@ -178,7 +258,16 @@
<!-- # lines or centralized lines -->
<div class="act_as_row lines">
<!--## date-->
<div class="act_as_cell left"><span t-field="line.date"/></div>
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.move.line'"/>
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.date"/></a>
</span>
</div>
<!--## move-->
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.move'"/>
@ -191,9 +280,27 @@
</span>
</div>
<!--## journal-->
<div class="act_as_cell left"><span t-field="line.journal"/></div>
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.journal'"/>
<span>
<a t-att-data-active-id="line.move_line_id.move_id.journal_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.journal"/></a>
</span>
</div>
<!--## account code-->
<div class="act_as_cell left"><span t-field="line.account"/></div>
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.account'"/>
<span>
<a t-att-data-active-id="line.move_line_id.account_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.account"/></a>
</span>
</div>
<!--## partner-->
<div class="act_as_cell left">
<t t-set="res_model" t-value="'res.partner'"/>
@ -205,26 +312,85 @@
</span>
</div>
<!--## ref - label-->
<div class="act_as_cell left"><span t-field="line.label"/></div>
<t t-if="show_cost_center">
<!--## cost_center-->
<div class="act_as_cell left"><span t-field="line.cost_center"/></div>
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.move.line'"/>
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.label"/></a>
</span>
</div>
<!--## cost_center-->
<t t-if="show_cost_center">
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account_analytic_account'"/>
<span t-if="line.cost_center">
<a t-att-data-active-id="line.move_line_id.analytic_account_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;"><t t-raw="line.cost_center"/></a>
</span>
</div>
</t>
<!--## matching_number-->
<div class="act_as_cell"><span t-field="line.matching_number"/></div>
<div class="act_as_cell">
<t t-set="res_model" t-value="'account_full_reconcile'"/>
<span t-if="line.matching_number">
<a t-att-data-active-id="line.move_line_id.full_reconcile_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;"><t t-raw="line.matching_number"/></a>
</span>
</div>
<!--## debit-->
<div class="act_as_cell amount"><span t-field="line.debit"/></div>
<div class="act_as_cell amount">
<t t-set="res_model" t-value="'account.move.line'"/>
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<!--## credit-->
<div class="act_as_cell amount"><span t-field="line.credit"/></div>
<div class="act_as_cell amount">
<t t-set="res_model" t-value="'account.move.line'"/>
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<!--## balance cumulated-->
<div class="act_as_cell amount"><span t-field="line.cumul_balance"/></div>
<!--## currency_name-->
<div class="act_as_cell"><span t-field="line.currency_name"/></div>
<t t-if="line.currency_name">
<div class="act_as_cell amount">
<t t-set="res_model" t-value="'account.move.line'"/>
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.cumul_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<t t-if="line.currency_id">
<!--## amount_currency-->
<div class="act_as_cell amount"><span t-field="line.amount_currency"/></div>
<div class="act_as_cell amount">
<t t-set="res_model" t-value="'account.move.line'"/>
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.amount_currency" t-options="{'widget': 'monetary', 'display_currency': line.currency_id}"/></a>
</span>
</div>
</t>
<t t-if="not line.currency_name">
<t t-if="not line.currency_id">
<!--## amount_currency-->
<div class="act_as_cell"/>
</t>
@ -240,32 +406,35 @@
<!--## date-->
<t t-if='type == "account_type"'>
<div class="act_as_cell first_column"
style="width: 33.33%;"><span
style="width: 33.81%;"><span
t-field="account_or_partner_object.code"/> - <span t-field="account_or_partner_object.name"/></div>
<div class="act_as_cell right"
style="width: 25.44%;">Ending balance</div>
style="width: 28.51%;">Ending balance</div>
</t>
<t t-if='type == "partner_type"'>
<div class="act_as_cell first_column" style="width: 33.33%;"/>
<div class="act_as_cell right" style="width: 25.44%;">Partner ending balance</div>
<div class="act_as_cell first_column" style="width: 33.81%;"/>
<div class="act_as_cell right" style="width: 28.51%;">Partner ending balance</div>
</t>
<t t-if="show_cost_center">
<!--## cost_center-->
<div class="act_as_cell" style="width: 8.77%"/>
</t>
<!--## matching_number-->
<div class="act_as_cell" style="width: 3.11%;"/>
<div class="act_as_cell" style="width: 2.63%;"/>
<!--## debit-->
<div class="act_as_cell amount" style="width: 6.57%;"><span
t-field="account_or_partner_object.final_debit"/></div>
<div class="act_as_cell amount" style="width: 6.57%;">
<span t-field="account_or_partner_object.final_debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## credit-->
<div class="act_as_cell amount" style="width: 6.57%;"><span
t-field="account_or_partner_object.final_credit"/></div>
<div class="act_as_cell amount" style="width: 6.57%;">
<span t-field="account_or_partner_object.final_credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## balance cumulated-->
<div class="act_as_cell amount" style="width: 6.57%;"><span
t-field="account_or_partner_object.final_balance"/></div>
<div class="act_as_cell amount" style="width: 6.57%;">
<span t-field="account_or_partner_object.final_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## currency_name + amount_currency-->
<div class="act_as_cell" style="width: 9.64%;"/>
<div class="act_as_cell" style="width: 6.57%;"/>
</div>
</div>

38
account_financial_report/report/templates/open_items.xml

@ -102,7 +102,7 @@
<!--## account code-->
<div class="act_as_cell" style="width: 5.38%;">Account</div>
<!--## partner-->
<div class="act_as_cell" style="width: 12.0%;">Partner
<div class="act_as_cell" style="width: 15.07%;">Partner
</div>
<!--## ref - label-->
<div class="act_as_cell" style="width: 25.5%;">Ref -
@ -115,8 +115,6 @@
</div>
<!--## amount_residual-->
<div class="act_as_cell" style="width: 6.57%;">Residual</div>
<!--## currency_name-->
<div class="act_as_cell" style="width: 3.07%;">Cur.</div>
<!--## amount_total_due_currency-->
<div class="act_as_cell amount" style="width: 6.57%;">Cur. Original</div>
<!--## amount_residual_currency-->
@ -174,27 +172,23 @@
</div>
<!--## amount_total_due-->
<div class="act_as_cell amount">
<span t-field="line.amount_total_due"/>
<span t-field="line.amount_total_due" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## amount_residual-->
<div class="act_as_cell amount">
<span t-field="line.amount_residual"/>
<span t-field="line.amount_residual" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## currency_name-->
<div class="act_as_cell">
<span t-field="line.currency_name"/>
</div>
<t t-if="line.currency_name">
<t t-if="line.currency_id">
<!--## amount_total_due_currency-->
<div class="act_as_cell amount">
<span t-field="line.amount_total_due_currency"/>
<span t-field="line.amount_total_due_currency" t-options="{'widget': 'monetary', 'display_currency': line.currency_id}"/>
</div>
<!--## amount_residual_currency-->
<div class="act_as_cell amount">
<span t-field="line.amount_residual_currency"/>
<span t-field="line.amount_residual_currency" t-options="{'widget': 'monetary', 'display_currency': line.currency_id}"/>
</div>
</t>
<t t-if="not line.currency_name">
<t t-if="not line.currency_id">
<!--## amount_total_due_currency-->
<div class="act_as_cell"/>
<!--## amount_residual_currency-->
@ -211,30 +205,30 @@
<div class="act_as_row labels" style="font-weight: bold;">
<!--## date-->
<t t-if='type == "account_type"'>
<div class="act_as_cell first_column" style="width: 34.3%;">
<div class="act_as_cell first_column" style="width: 37.37%;">
<span t-field="account_or_partner_object.code"/>
-
<span t-field="account_or_partner_object.name"/>
</div>
<div class="act_as_cell right" style="width: 26.4%;">Ending
<div class="act_as_cell right" style="width: 29.47%;">Ending
balance</div>
</t>
<t t-if='type == "partner_type"'>
<div class="act_as_cell first_column"
style="width: 34.3%;"/>
style="width: 37.37%;"/>
<div class="act_as_cell right"
style="width: 26.4%;">Partner ending balance</div>
style="width: 29.47%;">Partner ending balance</div>
</t>
<!--## date_due-->
<div class="act_as_cell" style="width: 6.26%;"/>
<!--## amount_total_due-->
<div class="act_as_cell amount" style="width: 7.57%;"/>
<div class="act_as_cell amount" style="width: 6.57%;"/>
<!--## amount_currency-->
<div class="act_as_cell amount" style="width: 7.57%;">
<span t-field="account_or_partner_object.final_amount_residual"/>
<div class="act_as_cell amount" style="width: 6.57%;">
<span t-field="account_or_partner_object.final_amount_residual" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## currency_name + amount_total_due_currency + amount_residual_currency -->
<div class="act_as_cell" style="width: 17.90%;"/>
<!--## amount_total_due_currency + amount_residual_currency -->
<div class="act_as_cell" style="width: 13.14%;"/>
</div>
</div>
</template>

337
account_financial_report/report/templates/trial_balance.xml

@ -27,24 +27,46 @@
<div class="act_as_table data_table" style="width: 100%;">
<!-- Display account header -->
<t t-call="account_financial_report.report_trial_balance_lines_header"/>
<!-- Display each lines -->
<t t-foreach="o.account_ids" t-as="line">
<t t-set="type" t-value='"account_type"'/>
<!-- Adapt -->
<t t-set="style" t-value="'font-size:8px;'"/>
<t t-set="padding" t-value="line.level * 4"/>
<t t-set="style" t-value="'font-size: ' + str(14 - line.level) + 'px; margin-left: ' + str(line.level * 4) + 'px;'"/>
<t t-if="line.account_group_id">
<t t-set="style" t-value="style + 'font-weight: bold; color: blue;'"/>
</t>
<!-- Display account lines -->
<t t-call="account_financial_report.report_trial_balance_line"/>
<!-- Adapt style -->
</t>
</div>
</t>
<!-- Display partner lines -->
<t t-if="show_partner_details">
<t t-set="padding" t-value="0"/>
<t t-foreach="o.account_ids" t-as="account">
<div class="page_break">
<t t-set="style" t-value="'font-size:8px;'"/>
<t t-set="padding" t-value="account.level * 4"/>
<t t-set="style" t-value="'font-size: ' + str(14 - account.level) + 'px; margin-left: ' + str(account.level * 4) + 'px;'"/>
<!-- Display account header -->
<div class="act_as_table list_table" style="margin-top: 10px;"/>
<div class="act_as_caption account_title"
style="width: 100%;">
<span t-field="account.code"/> - <span t-field="account.name"/>
<t t-set="res_model" t-value="'account.account'"/>
<span>
<a t-att-data-active-id="account.account_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
t-att-style="style">
<t t-raw="account.code"/> - <t t-raw="account.name"/></a>
</span>
</div>
<div class="act_as_table data_table"
@ -52,15 +74,22 @@
<!-- Display account/partner header -->
<t t-call="account_financial_report.report_trial_balance_lines_header"/>
<!-- Adapt style -->
<t t-set="padding" t-value="padding+4"/>
<!-- Display each partners -->
<t t-foreach="account.partner_ids" t-as="line">
<t t-set="type" t-value='"partner_type"'/>
<!-- Display partner line -->
<t t-call="account_financial_report.report_trial_balance_line"/>
</t>
<t t-set="padding" t-value="padding-4"/>
</div>
<!-- Display account footer -->
<t t-call="account_financial_report.report_trial_balance_account_footer"/>
<t t-set="type" t-value='"account_type"'/>
<t t-call="account_financial_report.report_trial_balance_account_footer"/>
</div>
</t>
</t>
@ -124,18 +153,241 @@
<div class="act_as_row lines">
<t t-if="not show_partner_details">
<!--## Code-->
<div class="act_as_cell left"><span t-field="line.code"/></div>
<div class="act_as_cell left">
<t t-if="line.account_id">
<t t-set="res_model" t-value="'account.account'"/>
<span>
<a t-att-data-active-id="line.account_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
t-att-style="style">
<t t-att-style="style" t-raw="line.code"/></a>
</span>
</t>
<t t-if="line.account_group_id">
<t t-set="res_model" t-value="'account.group'"/>
<span>
<a t-att-data-active-id="line.account_group_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
t-att-style="style">
<t t-att-style="style" t-raw="line.code"/></a>
</span>
</t>
</div>
</t>
<!--## Account/Partner-->
<div class="act_as_cell left"><span t-field="line.name"/></div>
<div class="act_as_cell left">
<t t-if="type == 'account_type'">
<t t-if="line.account_id">
<t t-set="res_model" t-value="'account.account'"/>
<span>
<a t-att-data-active-id="line.account_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
t-att-style="style">
<t t-att-style="style" t-raw="line.name"/></a>
</span>
</t>
<t t-if="line.account_group_id">
<t t-set="res_model" t-value="'account.group'"/>
<span>
<a t-att-data-active-id="line.account_group_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
t-att-style="style">
<t t-att-style="style" t-raw="line.name"/></a>
</span>
</t>
</t>
<t t-if="type == 'partner_type'">
<t t-set="res_model" t-value="'res.partner'"/>
<span>
<a t-att-data-active-id="line.partner_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
t-att-style="style">
<t t-att-style="style" t-raw="line.name"/></a>
</span>
</t>
</div>
<!--## Initial balance-->
<div class="act_as_cell amount"><span t-field="line.initial_balance"/></div>
<div class="act_as_cell amount">
<t t-if="type == 'account_type'">
<t t-if="line.account_id">
<t t-set="domain"
t-value="[('account_id', '=', line.account_id.id),
('date', '&lt;', o.date_from)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.initial_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="line.account_group_id">
<t t-set="domain"
t-value="[('account_id', 'in', line.compute_account_ids.ids),
('date', '&lt;', o.date_from)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.initial_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', line.report_account_id.account_id.id),
('partner_id', '=', line.partner_id.id),
('date', '&lt;', o.date_from)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.initial_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</div>
<!--## Debit-->
<div class="act_as_cell amount"><span t-field="line.debit"/></div>
<div class="act_as_cell amount">
<t t-if="type == 'account_type'">
<t t-if="line.account_id">
<t t-set="domain"
t-value="[('account_id', '=', line.account_id.id),
('date', '&gt;=', line.report_id.date_from),
('date', '&lt;=', line.report_id.date_to),
('debit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="line.account_group_id">
<t t-set="domain"
t-value="[('account_id', 'in', line.compute_account_ids.ids),
('date', '&gt;=', line.report_id.date_from),
('date', '&lt;=', line.report_id.date_to),
('debit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', line.report_account_id.account_id.id),
('partner_id', '=', line.partner_id.id),
('date', '&gt;=', line.report_account_id.report_id.date_from),
('date', '&lt;=', line.report_account_id.report_id.date_to),
('debit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</div>
<!--## Credit-->
<div class="act_as_cell amount"><span t-field="line.credit"/></div>
<div class="act_as_cell amount">
<t t-if="type == 'account_type'">
<t t-if="line.account_id">
<t t-set="domain"
t-value="[('account_id', '=', line.account_id.id),
('date', '&gt;=', line.report_id.date_from),
('date', '&lt;=', line.report_id.date_to),
('credit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="line.account_group_id">
<t t-set="domain"
t-value="[('account_id', 'in', line.compute_account_ids.ids),
('date', '&gt;=', line.report_id.date_from),
('date', '&lt;=', line.report_id.date_to),
('credit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', line.report_account_id.account_id.id),
('partner_id', '=', line.partner_id.id),
('date', '&gt;=', line.report_account_id.report_id.date_from),
('date', '&lt;=', line.report_account_id.report_id.date_to),
('credit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</div>
<!--## Ending balance-->
<div class="act_as_cell amount"><span t-field="line.final_balance"/></div>
<div class="act_as_cell amount">
<t t-if="type == 'account_type'">
<t t-if="line.account_id">
<t t-set="domain"
t-value="[('account_id', '=', line.account_id.id)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.final_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="line.account_group_id">
<t t-set="domain"
t-value="[('account_id', 'in', line.compute_account_ids.ids)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.final_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', line.report_account_id.account_id.id),
('partner_id', '=', line.partner_id.id)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.final_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</div>
</div>
</template>
@ -144,16 +396,71 @@
<div class="act_as_table list_table" style="width: 100%;">
<div class="act_as_row labels" style="font-weight: bold;">
<!--## Account-->
<div class="act_as_cell left" style="width: 61.44%;"><span
t-field="account.code"/> - <span t-field="account.name"/></div>
<div class="act_as_cell left" style="width: 61.44%;">
<t t-set="res_model" t-value="'account.account'"/>
<span>
<a t-att-data-active-id="account.account_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
t-att-style="style">
<t t-att-style="style" t-raw="account.code"/> - <t t-att-style="style" t-raw="account.name"/></a>
</span>
</div>
<!--## Initial balance-->
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.initial_balance"/></div>
<div class="act_as_cell amount" style="width: 9.64%;">
<t t-set="domain"
t-value="[('account_id', '=', account.account_id.id),
('date', '&lt;', o.date_from)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="account.initial_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<!--## Debit-->
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.debit"/></div>
<div class="act_as_cell amount" style="width: 9.64%;">
<t t-set="domain"
t-value="[('account_id', '=', account.account_id.id),
('date', '&gt;=', account.report_id.date_from),
('date', '&lt;=', account.report_id.date_to),
('debit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="account.debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<!--## Credit-->
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.credit"/></div>
<div class="act_as_cell amount" style="width: 9.64%;">
<t t-set="domain"
t-value="[('account_id', '=', account.account_id.id),
('date', '&gt;=', account.report_id.date_from),
('date', '&lt;=', account.report_id.date_to),
('credit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="account.credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<!--## Ending balance-->
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.final_balance"/></div>
<div class="act_as_cell amount" style="width: 9.64%;">
<t t-set="domain"
t-value="[('account_id', '=', account.account_id.id)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style" >
<t t-att-style="style" t-raw="account.final_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
</div>
</div>
</template>

169
account_financial_report/report/templates/vat_report.xml

@ -0,0 +1,169 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="account_financial_report.report_vat_report_qweb">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="account_financial_report.internal_layout" t-lang="user.lang">
<t t-call="account_financial_report.report_vat_report_base"/>
</t>
</t>
</t>
</template>
<template id="account_financial_report.report_vat_report_base">
<div class="page data_table">
<t t-set="title">VAT Report</t>
<div class="row">
<h4 class="mt0" t-esc="title or 'Odoo Report'"/>
</div>
<!-- Display filters -->
<t t-call="account_financial_report.report_vat_report_filters"/>
<div class="page_break"/>
<div class="act_as_table data_table" style="width: 100%;">
<!-- Display table headers for lines -->
<div class="act_as_thead">
<div class="act_as_row labels">
<!--## code-->
<div class="act_as_cell first_column" style="width: 5%;">Code</div>
<!--## name-->
<div class="act_as_cell" style="width: 65%;">Name</div>
<!--## net-->
<div class="act_as_cell" style="width: 15%;">Net</div>
<!--## tax-->
<div class="act_as_cell" style="width: 15%;">Tax</div>
</div>
</div>
<t t-foreach="o.taxtags_ids" t-as="tag">
<div class="act_as_row lines" style="font-weight: bold;">
<t t-if="tag.taxtag_id">
<t t-set="res_model" t-value="'account.account.tag'"/>
<t t-set="res_id" t-value="tag.taxtag_id.id"/>
</t>
<t t-if="tag.taxgroup_id">
<t t-set="res_model" t-value="'account.tax.group'"/>
<t t-set="res_id" t-value="tag.taxgroup_id.id"/>
</t>
<div class="act_as_cell left oe_tooltip_string" style="width: 5%;">
<span>
<a t-att-data-active-id="res_id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
t-att-style="style">
<t t-att-style="style" t-raw="tag.code"/></a>
</span>
</div>
<div class="act_as_cell left oe_tooltip_string" style="width: 65%;">
<span>
<a t-att-data-active-id="res_id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
t-att-style="style"><t t-att-style="style" t-raw="tag.name"/></a>
</span>
</div>
<div class="act_as_cell amount" style="width: 15%;">
<t t-set="domain"
t-value="[('tax_ids', 'in', [tax.tax_id.id for tax in tag.tax_ids]),
('date', '&gt;=', o.date_from),
('date', '&lt;=', o.date_to)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="tag.net"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<div class="act_as_cell amount" style="width: 15%;">
<t t-set="domain"
t-value="[('tax_line_id', 'in', [tax.tax_id.id for tax in tag.tax_ids]),
('date', '&gt;=', o.date_from),
('date', '&lt;=', o.date_to),
('tax_exigible', '=', True)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="tag.tax"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
</div>
<t t-if="o.tax_detail">
<t t-foreach="tag.tax_ids" t-as="tax">
<t t-set="res_model" t-value="'account.tax'"/>
<div class="act_as_row lines">
<div class="act_as_cell" style="width: 5%;"/>
<div class="act_as_cell left oe_tooltip_string" style="padding-left: 20px; width: 65%;">
<span>
<a t-att-data-active-id="tax.tax_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
t-att-style="style"><t t-att-style="style" t-raw="tax.name"/></a>
</span>
</div>
<div class="act_as_cell amount" style="width: 15%;">
<t t-set="domain"
t-value="[('tax_ids', 'in', tax.tax_id.ids),
('date', '&gt;=', o.date_from),
('date', '&lt;=', o.date_to),
('tax_exigible', '=', True)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="tax.net"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<div class="act_as_cell amount" style="width: 15%;">
<t t-set="domain"
t-value="[('tax_line_id', '=', tax.tax_id.id),
('date', '&gt;=', o.date_from),
('date', '&lt;=', o.date_to),
('tax_exigible', '=', True)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="tax.tax"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
</div>
</t>
</t>
</t>
</div>
</div>
</template>
<template id="account_financial_report.report_vat_report_filters">
<div class="act_as_table data_table" style="width: 100%;">
<div class="act_as_row labels">
<div class="act_as_cell">Date From</div>
<div class="act_as_cell">Date To</div>
<div class="act_as_cell">Based On</div>
</div>
<div class="act_as_row">
<div class="act_as_cell">
<span t-field="o.date_from"/>
</div>
<div class="act_as_cell">
<span t-field="o.date_to"/>
</div>
<div class="act_as_cell">
<span t-field="o.based_on"/>
</div>
</div>
</div>
</template>
</odoo>

263
account_financial_report/report/trial_balance.py

@ -1,4 +1,5 @@
# © 2016 Julien Coux (Camptocamp)
# © 2018 Forest and Biomass Romania SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api
@ -10,8 +11,8 @@ class TrialBalanceReport(models.TransientModel):
The class hierarchy is :
* TrialBalanceReport
** TrialBalanceReportAccount
*** TrialBalanceReportPartner
*** TrialBalanceReportAccount
**** TrialBalanceReportPartner
If "show_partner_details" is selected
"""
@ -27,6 +28,11 @@ class TrialBalanceReport(models.TransientModel):
filter_account_ids = fields.Many2many(comodel_name='account.account')
filter_partner_ids = fields.Many2many(comodel_name='res.partner')
show_partner_details = fields.Boolean()
hierarchy_on = fields.Selection([('computed', 'Computed Accounts'),
('relation', 'Child Accounts')],
string='Hierarchy On',
required=True,
default='computed')
# General Ledger Report Data fields,
# used as base for compute the data reports
@ -43,7 +49,7 @@ class TrialBalanceReport(models.TransientModel):
class TrialBalanceReportAccount(models.TransientModel):
_name = 'report_trial_balance_account'
_order = 'code ASC'
_order = 'sequence, code ASC, name'
report_id = fields.Many2one(
comodel_name='report_trial_balance',
@ -51,12 +57,30 @@ class TrialBalanceReportAccount(models.TransientModel):
index=True
)
# Data fields, used to keep link with real object
sequence = fields.Integer(index=True, default=0)
level = fields.Integer(index=True, default=0)
# Data fields, used to keep link with real object
account_id = fields.Many2one(
'account.account',
index=True
)
account_group_id = fields.Many2one(
'account.group',
index=True
)
parent_id = fields.Many2one(
'account.group',
index=True
)
child_account_ids = fields.Char(
string="Accounts")
compute_account_ids = fields.Many2many(
'account.account',
string="Accounts", store=True)
# Data fields, used for report display
code = fields.Char()
name = fields.Char()
@ -138,14 +162,14 @@ class TrialBalanceReportCompute(models.TransientModel):
rcontext['o'] = report
result['html'] = self.env.ref(
'account_financial_report.report_trial_balance').render(
rcontext)
rcontext)
return result
@api.model
def get_html(self, given_context=None):
return self._get_html()
def _prepare_report_general_ledger(self):
def _prepare_report_general_ledger(self, account_ids):
self.ensure_one()
return {
'date_from': self.date_from,
@ -153,7 +177,7 @@ class TrialBalanceReportCompute(models.TransientModel):
'only_posted_moves': self.only_posted_moves,
'hide_account_balance_at_0': self.hide_account_balance_at_0,
'company_id': self.company_id.id,
'filter_account_ids': [(6, 0, self.filter_account_ids.ids)],
'filter_account_ids': [(6, 0, account_ids.ids)],
'filter_partner_ids': [(6, 0, self.filter_partner_ids.ids)],
'fy_start_date': self.fy_start_date,
}
@ -165,21 +189,38 @@ class TrialBalanceReportCompute(models.TransientModel):
# The data of Trial Balance Report
# are based on General Ledger Report data.
model = self.env['report_general_ledger']
if self.filter_account_ids:
account_ids = self.filter_account_ids
else:
account_ids = self.env['account.account'].search(
[('company_id', '=', self.company_id.id)])
self.general_ledger_id = model.create(
self._prepare_report_general_ledger()
self._prepare_report_general_ledger(account_ids)
)
self.general_ledger_id.compute_data_for_report(
with_line_details=False, with_partners=self.show_partner_details
)
# Compute report data
self._inject_account_values()
self._inject_account_values(account_ids)
if self.show_partner_details:
self._inject_partner_values()
# Refresh cache because all data are computed with SQL requests
if not self.filter_account_ids:
self._inject_account_group_values()
if self.hierarchy_on == 'computed':
self._update_account_group_computed_values()
else:
self._update_account_group_child_values()
self._update_account_sequence()
self._add_account_group_account_values()
self.refresh()
if not self.filter_account_ids:
self._compute_group_accounts()
else:
for line in self.account_ids:
line.write({'level': 0})
def _inject_account_values(self):
def _inject_account_values(self, account_ids):
"""Inject report values for report_trial_balance_account"""
query_inject_account = """
INSERT INTO
@ -189,6 +230,7 @@ INSERT INTO
create_uid,
create_date,
account_id,
parent_id,
code,
name,
initial_balance,
@ -200,22 +242,29 @@ SELECT
%s AS report_id,
%s AS create_uid,
NOW() AS create_date,
rag.account_id,
rag.code,
rag.name,
rag.initial_balance AS initial_balance,
rag.final_debit - rag.initial_debit AS debit,
rag.final_credit - rag.initial_credit AS credit,
rag.final_balance AS final_balance
acc.id,
acc.group_id,
acc.code,
acc.name,
coalesce(rag.initial_balance, 0) AS initial_balance,
coalesce(rag.final_debit - rag.initial_debit, 0) AS debit,
coalesce(rag.final_credit - rag.initial_credit, 0) AS credit,
coalesce(rag.final_balance, 0) AS final_balance
FROM
report_general_ledger_account rag
account_account acc
LEFT OUTER JOIN report_general_ledger_account AS rag
ON rag.account_id = acc.id AND rag.report_id = %s
WHERE
rag.report_id = %s
acc.id in %s
"""
if self.hide_account_balance_at_0:
query_inject_account += """ AND
final_balance IS NOT NULL AND final_balance != 0"""
query_inject_account_params = (
self.id,
self.env.uid,
self.general_ledger_id.id,
account_ids._ids,
)
self.env.cr.execute(query_inject_account, query_inject_account_params)
@ -261,3 +310,179 @@ AND ra.report_id = %s
self.id,
)
self.env.cr.execute(query_inject_partner, query_inject_partner_params)
def _inject_account_group_values(self):
"""Inject report values for report_trial_balance_account"""
query_inject_account_group = """
INSERT INTO
report_trial_balance_account
(
report_id,
create_uid,
create_date,
account_group_id,
parent_id,
code,
name,
sequence,
level
)
SELECT
%s AS report_id,
%s AS create_uid,
NOW() AS create_date,
accgroup.id,
accgroup.parent_id,
coalesce(accgroup.code_prefix, accgroup.name),
accgroup.name,
accgroup.parent_left * 100000,
accgroup.level
FROM
account_group accgroup"""
query_inject_account_params = (
self.id,
self.env.uid,
)
self.env.cr.execute(query_inject_account_group,
query_inject_account_params)
def _update_account_group_child_values(self):
"""Compute values for report_trial_balance_account group in child."""
query_update_account_group = """
WITH computed AS (WITH RECURSIVE cte AS (
SELECT account_group_id, code, account_group_id AS parent_id,
initial_balance, debit, credit, final_balance
FROM report_trial_balance_account
WHERE report_id = %s
GROUP BY report_trial_balance_account.id
UNION ALL
SELECT c.account_group_id, c.code, p.account_group_id,
p.initial_balance, p.debit, p.credit, p.final_balance
FROM cte c
JOIN report_trial_balance_account p USING (parent_id)
WHERE p.report_id = %s
)
SELECT account_group_id, code,
sum(initial_balance) AS initial_balance, sum(debit) AS debit,
sum(credit) AS credit, sum(final_balance) AS final_balance
FROM cte
GROUP BY cte.account_group_id, cte.code
ORDER BY account_group_id
)
UPDATE report_trial_balance_account
SET initial_balance = computed.initial_balance,
debit = computed.debit,
credit = computed.credit,
final_balance = computed.final_balance
FROM computed
WHERE report_trial_balance_account.account_group_id = computed.account_group_id
AND report_trial_balance_account.report_id = %s
"""
query_update_account_params = (self.id, self.id, self.id,)
self.env.cr.execute(query_update_account_group,
query_update_account_params)
def _add_account_group_account_values(self):
"""Compute values for report_trial_balance_account group in child."""
query_update_account_group = """
DROP AGGREGATE IF EXISTS array_concat_agg(anyarray);
CREATE AGGREGATE array_concat_agg(anyarray) (
SFUNC = array_cat,
STYPE = anyarray
);
WITH aggr AS(WITH computed AS (WITH RECURSIVE cte AS (
SELECT account_group_id, account_group_id AS parent_id,
ARRAY[account_id]::int[] as child_account_ids
FROM report_trial_balance_account
WHERE report_id = %s
GROUP BY report_trial_balance_account.id
UNION ALL
SELECT c.account_group_id, p.account_group_id, ARRAY[p.account_id]::int[]
FROM cte c
JOIN report_trial_balance_account p USING (parent_id)
WHERE p.report_id = %s
)
SELECT account_group_id,
array_concat_agg(DISTINCT child_account_ids)::int[] as child_account_ids
FROM cte
GROUP BY cte.account_group_id, cte.child_account_ids
ORDER BY account_group_id
)
SELECT account_group_id,
array_concat_agg(DISTINCT child_account_ids)::int[]
AS child_account_ids from computed
GROUP BY account_group_id)
UPDATE report_trial_balance_account
SET child_account_ids = aggr.child_account_ids
FROM aggr
WHERE report_trial_balance_account.account_group_id = aggr.account_group_id
AND report_trial_balance_account.report_id = %s
"""
query_update_account_params = (self.id, self.id, self.id,)
self.env.cr.execute(query_update_account_group,
query_update_account_params)
def _update_account_group_computed_values(self):
"""Compute values for report_trial_balance_account group in compute."""
query_update_account_group = """
WITH RECURSIVE accgroup AS
(SELECT
accgroup.id,
coalesce(sum(ra.initial_balance),0) as initial_balance,
coalesce(sum(ra.debit),0) as debit,
coalesce(sum(ra.credit),0) as credit,
coalesce(sum(ra.final_balance),0) as final_balance
FROM
account_group accgroup
LEFT OUTER JOIN account_account AS acc
ON strpos(acc.code, accgroup.code_prefix) = 1
LEFT OUTER JOIN report_trial_balance_account AS ra
ON ra.account_id = acc.id
WHERE ra.report_id = %s
GROUP BY accgroup.id
)
UPDATE report_trial_balance_account
SET initial_balance = accgroup.initial_balance,
debit = accgroup.debit,
credit = accgroup.credit,
final_balance = accgroup.final_balance
FROM accgroup
WHERE report_trial_balance_account.account_group_id = accgroup.id
"""
query_update_account_params = (self.id,)
self.env.cr.execute(query_update_account_group,
query_update_account_params)
def _update_account_sequence(self):
"""Compute sequence, level for report_trial_balance_account account."""
query_update_account_group = """
UPDATE report_trial_balance_account
SET sequence = newline.sequence + 1,
level = newline.level + 1
FROM report_trial_balance_account as newline
WHERE newline.account_group_id = report_trial_balance_account.parent_id
AND report_trial_balance_account.report_id = newline.report_id
AND report_trial_balance_account.account_id is not null
AND report_trial_balance_account.report_id = %s"""
query_update_account_params = (self.id,)
self.env.cr.execute(query_update_account_group,
query_update_account_params)
def _compute_group_accounts(self):
groups = self.account_ids.filtered(
lambda a: a.account_group_id is not False)
for group in groups:
if self.hierarchy_on == 'compute':
group.compute_account_ids = \
group.account_group_id.compute_account_ids
else:
if group.child_account_ids:
chacc = group.child_account_ids.replace(
'}', '').replace('{', '').split(',')
if 'NULL' in chacc:
chacc.remove('NULL')
if chacc:
group.compute_account_ids = [
(6, 0, [int(g) for g in chacc])]

9
account_financial_report/report/trial_balance_xlsx.py

@ -1,4 +1,3 @@
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
@ -60,12 +59,12 @@ class TrialBalanceXslx(models.AbstractModel):
def _get_report_filters(self, report):
return [
[_('Date range filter'),
_('From: %s To: %s') % (report.date_from, report.date_to)],
_('From: %s To: %s') % (report.date_from, report.date_to)],
[_('Target moves filter'),
_('All posted entries') if report.only_posted_moves
else _('All entries')],
_('All posted entries') if report.only_posted_moves else _(
'All entries')],
[_('Account balance at 0 filter'),
_('Hide') if report.hide_account_balance_at_0 else _('Show')],
_('Hide') if report.hide_account_balance_at_0 else _('Show')],
]
def _get_col_count_filter_name(self):

351
account_financial_report/report/vat_report.py

@ -0,0 +1,351 @@
# Copyright 2018 Forest and Biomass Romania
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class VATReport(models.TransientModel):
_name = "report_vat_report"
""" Here, we just define class fields.
For methods, go more bottom at this file.
The class hierarchy is :
* VATReport
** VATReportTaxTags
*** VATReportTax
"""
# Filters fields, used for data computation
company_id = fields.Many2one(comodel_name='res.company')
date_from = fields.Date()
date_to = fields.Date()
based_on = fields.Selection([('taxtags', 'Tax Tags'),
('taxgroups', 'Tax Groups')],
string='Based On',
required=True,
default='taxtags')
tax_detail = fields.Boolean('Tax Detail')
# Data fields, used to browse report data
taxtags_ids = fields.One2many(
comodel_name='report_vat_report_taxtag',
inverse_name='report_id'
)
class VATReportTaxTags(models.TransientModel):
_name = 'report_vat_report_taxtag'
_order = 'code ASC'
report_id = fields.Many2one(
comodel_name='report_vat_report',
ondelete='cascade',
index=True
)
# Data fields, used to keep link with real object
taxtag_id = fields.Many2one(
'account.account.tag',
index=True
)
taxgroup_id = fields.Many2one(
'account.tax.group',
index=True
)
# Data fields, used for report display
code = fields.Char()
name = fields.Char()
net = fields.Float(digits=(16, 2))
tax = fields.Float(digits=(16, 2))
# Data fields, used to browse report data
tax_ids = fields.One2many(
comodel_name='report_vat_report_tax',
inverse_name='report_tax_id'
)
class VATReportTax(models.TransientModel):
_name = 'report_vat_report_tax'
_order = 'name ASC'
report_tax_id = fields.Many2one(
comodel_name='report_vat_report_taxtag',
ondelete='cascade',
index=True
)
# Data fields, used to keep link with real object
tax_id = fields.Many2one(
'account.tax',
index=True
)
# Data fields, used for report display
code = fields.Char()
name = fields.Char()
net = fields.Float(digits=(16, 2))
tax = fields.Float(digits=(16, 2))
class VATReportCompute(models.TransientModel):
""" Here, we just define methods.
For class fields, go more top at this file.
"""
_inherit = 'report_vat_report'
@api.multi
def print_report(self, report_type='qweb'):
self.ensure_one()
if report_type == 'xlsx':
report_name = 'a_f_r.report_vat_report_xlsx'
else:
report_name = 'account_financial_report.report_vat_report_qweb'
context = dict(self.env.context)
action = self.env['ir.actions.report'].search(
[('report_name', '=', report_name),
('report_type', '=', report_type)], limit=1)
return action.with_context(context).report_action(self)
def _get_html(self):
result = {}
rcontext = {}
context = dict(self.env.context)
report = self.browse(context.get('active_id'))
if report:
rcontext['o'] = report
result['html'] = self.env.ref(
'account_financial_report.report_vat_report').render(
rcontext)
return result
@api.model
def get_html(self, given_context=None):
return self.with_context(given_context)._get_html()
@api.multi
def compute_data_for_report(self):
self.ensure_one()
# Compute report data
if self.based_on == 'taxtags':
self._inject_taxtags_values()
self._inject_tax_taxtags_values()
elif self.based_on == 'taxgroups':
self._inject_taxgroups_values()
self._inject_tax_taxgroups_values()
# Refresh cache because all data are computed with SQL requests
self.refresh()
def _inject_taxtags_values(self):
"""Inject report values for report_vat_report_taxtags."""
query_inject_taxtags = """
WITH
taxtags AS
(SELECT coalesce(regexp_replace(tag.name,
'[^0-9\\.]+', '', 'g'), ' ') AS code,
tag.name, tag.id,
coalesce(sum(movetax.tax_base_amount), 0.00) AS net,
coalesce(sum(movetax.balance), 0.00) AS tax
FROM
account_account_tag AS tag
INNER JOIN account_tax_account_tag AS taxtag
ON tag.id = taxtag.account_account_tag_id
INNER JOIN account_tax AS tax
ON tax.id = taxtag.account_tax_id
INNER JOIN account_move_line AS movetax
ON movetax.tax_line_id = tax.id
INNER JOIN account_move AS move
ON move.id = movetax.move_id
WHERE tag.id is not null AND movetax.tax_exigible
AND move.company_id = %s AND move.date >= %s
AND move.date <= %s AND move.state = 'posted'
GROUP BY tag.id
ORDER BY code, tag.name
)
INSERT INTO
report_vat_report_taxtag
(
report_id,
create_uid,
create_date,
taxtag_id,
code,
name,
net, tax
)
SELECT
%s AS report_id,
%s AS create_uid,
NOW() AS create_date,
tag.id,
tag.code,
tag.name,
abs(tag.net),
abs(tag.tax)
FROM
taxtags tag
"""
query_inject_taxtags_params = (self.company_id.id, self.date_from,
self.date_to, self.id, self.env.uid)
self.env.cr.execute(query_inject_taxtags, query_inject_taxtags_params)
def _inject_taxgroups_values(self):
"""Inject report values for report_vat_report_taxtags."""
query_inject_taxgroups = """
WITH
taxgroups AS
(SELECT coalesce(taxgroup.sequence, 0) AS code,
taxgroup.name, taxgroup.id,
coalesce(sum(movetax.tax_base_amount), 0.00) AS net,
coalesce(sum(movetax.balance), 0.00) AS tax
FROM
account_tax_group AS taxgroup
INNER JOIN account_tax AS tax
ON tax.tax_group_id = taxgroup.id
INNER JOIN account_move_line AS movetax
ON movetax.tax_line_id = tax.id
INNER JOIN account_move AS move
ON move.id = movetax.move_id
WHERE taxgroup.id is not null AND movetax.tax_exigible
AND move.company_id = %s AND move.date >= %s
AND move.date <= %s AND move.state = 'posted'
GROUP BY taxgroup.id
ORDER BY code, taxgroup.name
)
INSERT INTO
report_vat_report_taxtag
(
report_id,
create_uid,
create_date,
taxgroup_id,
code,
name,
net, tax
)
SELECT
%s AS report_id,
%s AS create_uid,
NOW() AS create_date,
groups.id,
groups.code,
groups.name,
abs(groups.net),
abs(groups.tax)
FROM
taxgroups groups
"""
query_inject_taxgroups_params = (self.company_id.id, self.date_from,
self.date_to, self.id, self.env.uid)
self.env.cr.execute(query_inject_taxgroups,
query_inject_taxgroups_params)
def _inject_tax_taxtags_values(self):
""" Inject report values for report_vat_report_tax. """
# pylint: disable=sql-injection
query_inject_tax = """
WITH
taxtags_tax AS
(
SELECT
tag.id AS report_tax_id, ' ' AS code,
tax.name, tax.id,
coalesce(sum(movetax.tax_base_amount), 0.00) AS net,
coalesce(sum(movetax.balance), 0.00) AS tax
FROM
report_vat_report_taxtag AS tag
INNER JOIN account_tax_account_tag AS taxtag
ON tag.taxtag_id = taxtag.account_account_tag_id
INNER JOIN account_tax AS tax
ON tax.id = taxtag.account_tax_id
INNER JOIN account_move_line AS movetax
ON movetax.tax_line_id = tax.id
INNER JOIN account_move AS move
ON move.id = movetax.move_id
WHERE tag.id is not null AND movetax.tax_exigible
AND tag.report_id = %s AND move.company_id = %s
AND move.date >= %s AND move.date <= %s
AND move.state = 'posted'
GROUP BY tag.id, tax.id
ORDER BY tax.name
)
INSERT INTO
report_vat_report_tax
(
report_tax_id,
create_uid,
create_date,
tax_id,
name,
net,
tax
)
SELECT
tt.report_tax_id,
%s AS create_uid,
NOW() AS create_date,
tt.id,
tt.name,
abs(tt.net),
abs(tt.tax)
FROM
taxtags_tax tt
"""
query_inject_tax_params = (self.id, self.company_id.id, self.date_from,
self.date_to, self.env.uid)
self.env.cr.execute(query_inject_tax, query_inject_tax_params)
def _inject_tax_taxgroups_values(self):
""" Inject report values for report_vat_report_tax. """
# pylint: disable=sql-injection
query_inject_tax = """
WITH
taxtags_tax AS
(
SELECT
taxtag.id AS report_tax_id, ' ' AS code,
tax.name, tax.id,
coalesce(sum(movetax.tax_base_amount), 0.00) AS net,
coalesce(sum(movetax.balance), 0.00) AS tax
FROM
report_vat_report_taxtag AS taxtag
INNER JOIN account_tax AS tax
ON tax.tax_group_id = taxtag.taxgroup_id
INNER JOIN account_move_line AS movetax
ON movetax.tax_line_id = tax.id
INNER JOIN account_move AS move
ON move.id = movetax.move_id
WHERE taxtag.id is not null AND movetax.tax_exigible
AND taxtag.report_id = %s AND move.company_id = %s
AND move.date >= %s AND move.date <= %s
AND move.state = 'posted'
GROUP BY taxtag.id, tax.id
ORDER BY tax.name
)
INSERT INTO
report_vat_report_tax
(
report_tax_id,
create_uid,
create_date,
tax_id,
name,
net,
tax
)
SELECT
tt.report_tax_id,
%s AS create_uid,
NOW() AS create_date,
tt.id,
tt.name,
abs(tt.net),
abs(tt.tax)
FROM
taxtags_tax tt
"""
query_inject_tax_params = (self.id, self.company_id.id, self.date_from,
self.date_to, self.env.uid)
self.env.cr.execute(query_inject_tax, query_inject_tax_params)

51
account_financial_report/report/vat_report_xlsx.py

@ -0,0 +1,51 @@
# Copyright 2018 Forest and Biomass Romania
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import _, models
class VATReportXslx(models.AbstractModel):
_name = 'report.a_f_r.report_vat_report_xlsx'
_inherit = 'report.account_financial_report.abstract_report_xlsx'
def _get_report_name(self):
return _('VAT Report')
def _get_report_columns(self, report):
return {
0: {'header': _('Code'), 'field': 'code', 'width': 5},
1: {'header': _('Name'), 'field': 'name', 'width': 100},
2: {'header': _('Net'),
'field': 'net',
'type': 'amount',
'width': 14},
3: {'header': _('Tax'),
'field': 'tax',
'type': 'amount',
'width': 14},
}
def _get_report_filters(self, report):
return [
[_('Date from'), report.date_from],
[_('Date to'), report.date_to],
[_('Based on'), report.based_on],
]
def _get_col_count_filter_name(self):
return 0
def _get_col_count_filter_value(self):
return 2
def _generate_report_content(self, workbook, report):
# For each taxtag
self.write_array_header()
for taxtag in report.taxtags_ids:
# Write taxtag line
self.write_line(taxtag)
# For each tax if detail taxes
if report.tax_detail:
for tax in taxtag.tax_ids:
self.write_line(tax)

32
account_financial_report/reports.xml

@ -75,6 +75,24 @@
file="account_financial_report.report_aged_partner_balance_html"
/>
<!-- VAT Report -->
<report
id="action_report_vat_report_qweb"
model="report_vat_report"
string="VAT Report"
report_type="qweb-pdf"
name="account_financial_report.report_vat_report_qweb"
file="account_financial_report.report_vat_report_qweb"
/>
<report
id="action_report_vat_report_html"
model="report_vat_report"
string="VAT Report"
report_type="qweb-html"
name="account_financial_report.report_vat_report_qweb"
file="account_financial_report.report_vat_report_html"
/>
<!-- PDF REPORTS : paperformat -->
<record id="report_qweb_paperformat" model="report.paperformat">
@ -109,6 +127,11 @@
model="ir.actions.report">
<field name="paperformat_id" ref="report_qweb_paperformat"/>
</record>
<record id="action_report_vat_report_qweb"
model="ir.actions.report">
<field name="paperformat_id" ref="report_qweb_paperformat"/>
</record>
<!-- XLSX REPORTS -->
@ -147,5 +170,14 @@
<field name="report_type">xlsx</field>
<field name="report_file">report_aged_partner_balance</field>
</record>
<record id="action_report_vat_report_xlsx" model="ir.actions.report">
<field name="name">VAT Report XLSX</field>
<field name="model">report_vat_report</field>
<field name="type">ir.actions.report</field>
<field name="report_name">a_f_r.report_vat_report_xlsx</field>
<field name="report_type">xlsx</field>
<field name="report_file">report_vat_report</field>
</record>
</odoo>

8
account_financial_report/static/src/js/account_financial_report_backend.js

@ -4,12 +4,8 @@ odoo.define('account_financial_report.account_financial_report_backend', functio
var core = require('web.core');
var Widget = require('web.Widget');
var ControlPanelMixin = require('web.ControlPanelMixin');
var session = require('web.session');
var ReportWidget = require('account_financial_report.account_financial_report_widget');
var framework = require('web.framework');
var crash_manager = require('web.crash_manager');
var QWeb = core.qweb;
var report_backend = Widget.extend(ControlPanelMixin, {
// Stores all the parameters of the action.
@ -79,7 +75,7 @@ var report_backend = Widget.extend(ControlPanelMixin, {
this._super();
this.update_cp();
},
print: function(e) {
print: function() {
var self = this;
this._rpc({
model: this.given_context.model,
@ -90,7 +86,7 @@ var report_backend = Widget.extend(ControlPanelMixin, {
self.do_action(result);
});
},
export: function(e) {
export: function() {
var self = this;
this._rpc({
model: this.given_context.model,

19
account_financial_report/static/src/js/account_financial_report_widgets.js

@ -5,13 +5,11 @@ odoo.define('account_financial_report.account_financial_report_widget', function
var core = require('web.core');
var Widget = require('web.Widget');
var QWeb = core.qweb;
var _t = core._t;
var accountFinancialReportWidget = Widget.extend({
events: {
'click .o_account_financial_reports_web_action': 'boundLink',
'click .o_account_financial_reports_web_action_multi': 'boundLinkmulti',
},
init: function(parent) {
this._super.apply(this, arguments);
@ -20,8 +18,8 @@ var accountFinancialReportWidget = Widget.extend({
return this._super.apply(this, arguments);
},
boundLink: function(e) {
var res_model = $(e.target).data('res-model')
var res_id = $(e.target).data('active-id')
var res_model = $(e.target).data('res-model');
var res_id = $(e.target).data('active-id');
return this.do_action({
type: 'ir.actions.act_window',
res_model: res_model,
@ -30,6 +28,17 @@ var accountFinancialReportWidget = Widget.extend({
target: 'current'
});
},
boundLinkmulti: function(e) {
var res_model = $(e.target).data('res-model');
var domain = $(e.target).data('domain');
return this.do_action({
type: 'ir.actions.act_window',
res_model: res_model,
domain: domain,
views: [[false, "list"], [false, "form"]],
target: 'current'
});
},
});
return accountFinancialReportWidget;

2
account_financial_report/tests/__init__.py

@ -3,7 +3,9 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
from . import abstract_test
from . import abstract_test_tax_report
from . import test_aged_partner_balance
from . import test_general_ledger
from . import test_open_items
from . import test_trial_balance
from . import test_vat_report

4
account_financial_report/tests/abstract_test.py

@ -1,12 +1,12 @@
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
from odoo.tests import common
from odoo.tools import test_reports
import logging
_logger = logging.getLogger(__name__)

75
account_financial_report/tests/abstract_test_tax_report.py

@ -0,0 +1,75 @@
# Copyright 2018 Forest and Biomass Romania
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
from odoo.tests.common import TransactionCase
from odoo.tools import test_reports
_logger = logging.getLogger(__name__)
class AbstractTest(TransactionCase):
"""Common technical tests for all reports."""
def setUp(cls):
super(AbstractTest, cls).setUp()
cls.model = cls._getReportModel()
cls.qweb_report_name = cls._getQwebReportName()
cls.xlsx_report_name = cls._getXlsxReportName()
cls.xlsx_action_name = cls._getXlsxReportActionName()
cls.report_title = cls._getReportTitle()
cls.base_filters = cls._getBaseFilters()
cls.report = cls.model.create(cls.base_filters)
cls.report.compute_data_for_report()
def test_html(self):
test_reports.try_report(self.env.cr, self.env.uid,
self.qweb_report_name,
[self.report.id],
report_type='qweb-html')
def test_qweb(self):
test_reports.try_report(self.env.cr, self.env.uid,
self.qweb_report_name,
[self.report.id],
report_type='qweb-pdf')
def test_xlsx(self):
test_reports.try_report(self.env.cr, self.env.uid,
self.xlsx_report_name,
[self.report.id],
report_type='xlsx')
def test_print(self):
self.report.print_report('qweb')
self.report.print_report('xlsx')
def test_generation_report_html(self):
"""Check if report HTML is correctly generated"""
# Check if returned report action is correct
report_type = 'qweb-html'
report_action = self.report.print_report(report_type)
self.assertDictContainsSubset(
{
'type': 'ir.actions.report',
'report_name': self.qweb_report_name,
'report_type': 'qweb-html',
},
report_action
)
# Check if report template is correct
report = self.env['ir.actions.report'].search(
[('report_name', '=', self.qweb_report_name),
('report_type', '=', report_type)], limit=1)
self.assertEqual(report.report_type, 'qweb-html')
rep = report.render(self.report.ids, {})
self.assertTrue(self.report_title.encode('utf8') in rep[0])

1
account_financial_report/tests/test_aged_partner_balance.py

@ -1,4 +1,3 @@
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

20
account_financial_report/tests/test_general_ledger.py

@ -1,11 +1,11 @@
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import time
from . import abstract_test
from odoo.tests import common
from . import abstract_test
class TestGeneralLedger(abstract_test.AbstractTest):
@ -78,14 +78,14 @@ class TestGeneralLedgerReport(common.TransactionCase):
)], limit=1)
def _add_move(
self,
date,
receivable_debit,
receivable_credit,
income_debit,
income_credit,
unaffected_debit=0,
unaffected_credit=0
self,
date,
receivable_debit,
receivable_credit,
income_debit,
income_credit,
unaffected_debit=0,
unaffected_credit=0
):
move_name = 'expense accrual'
journal = self.env['account.journal'].search([

1
account_financial_report/tests/test_open_items.py

@ -1,4 +1,3 @@
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

440
account_financial_report/tests/test_trial_balance.py

@ -1,9 +1,10 @@
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import time
from odoo.tests import common
from . import abstract_test
@ -40,6 +41,12 @@ class TestTrialBalance(abstract_test.AbstractTest):
{'only_posted_moves': True},
{'hide_account_balance_at_0': True},
{'show_partner_details': True},
{'hierarchy_on': 'computed'},
{'hierarchy_on': 'relation'},
{'only_posted_moves': True, 'hide_account_balance_at_0': True,
'hierarchy_on': 'computed'},
{'only_posted_moves': True, 'hide_account_balance_at_0': True,
'hierarchy_on': 'relation'},
{'only_posted_moves': True, 'hide_account_balance_at_0': True},
{'only_posted_moves': True, 'show_partner_details': True},
{'hide_account_balance_at_0': True, 'show_partner_details': True},
@ -52,3 +59,434 @@ class TestTrialBalance(abstract_test.AbstractTest):
def _partner_test_is_possible(self, filters):
return 'show_partner_details' in filters
@common.at_install(False)
@common.post_install(True)
class TestTrialBalanceReport(common.TransactionCase):
def setUp(self):
super(TestTrialBalanceReport, self).setUp()
group_obj = self.env['account.group']
acc_obj = self.env['account.account']
self.group1 = group_obj.create(
{'code_prefix': '1',
'name': 'Group 1'})
self.group11 = group_obj.create(
{'code_prefix': '11',
'name': 'Group 11',
'parent_id': self.group1.id})
self.group2 = group_obj.create(
{'code_prefix': '2',
'name': 'Group 2'})
self.account100 = acc_obj.create(
{'code': '100',
'name': 'Account 100',
'group_id': self.group1.id,
'user_type_id': self.env.ref(
'account.data_account_type_receivable').id,
'reconcile': True})
self.account110 = self.env['account.account'].search([
(
'user_type_id',
'=',
self.env.ref('account.data_unaffected_earnings').id
)], limit=1)
self.account200 = acc_obj.create(
{'code': '200',
'name': 'Account 200',
'group_id': self.group2.id,
'user_type_id': self.env.ref(
'account.data_account_type_other_income').id})
self.account300 = acc_obj.create(
{'code': '300',
'name': 'Account 300',
'user_type_id': self.env.ref(
'account.data_account_type_other_income').id})
self.account301 = acc_obj.create(
{'code': '301',
'name': 'Account 301',
'group_id': self.group2.id,
'user_type_id': self.env.ref(
'account.data_account_type_other_income').id})
self.previous_fy_date_start = '2015-01-01'
self.previous_fy_date_end = '2015-12-31'
self.fy_date_start = '2016-01-01'
self.fy_date_end = '2016-12-31'
self.date_start = '2016-01-01'
self.date_end = '2016-12-31'
def _add_move(
self,
date,
receivable_debit,
receivable_credit,
income_debit,
income_credit,
unaffected_debit=0,
unaffected_credit=0
):
move_name = 'expense accrual'
journal = self.env['account.journal'].search([
('code', '=', 'MISC')])
partner = self.env.ref('base.res_partner_12')
move_vals = {
'journal_id': journal.id,
'partner_id': partner.id,
'name': move_name,
'date': date,
'line_ids': [
(0, 0, {
'name': move_name,
'debit': receivable_debit,
'credit': receivable_credit,
'account_id': self.account100.id}),
(0, 0, {
'name': move_name,
'debit': income_debit,
'credit': income_credit,
'account_id': self.account200.id}),
(0, 0, {
'name': move_name,
'debit': unaffected_debit,
'credit': unaffected_credit,
'account_id': self.account110.id}),
(0, 0, {
'name': move_name,
'debit': receivable_debit,
'credit': receivable_credit,
'account_id': self.account300.id}),
(0, 0, {
'name': move_name,
'debit': receivable_credit,
'credit': receivable_debit,
'account_id': self.account301.id})
]}
move = self.env['account.move'].create(move_vals)
move.post()
def _get_report_lines(self, with_partners=False, hierarchy_on='computed'):
company = self.env.ref('base.main_company')
trial_balance = self.env['report_trial_balance'].create({
'date_from': self.date_start,
'date_to': self.date_end,
'only_posted_moves': True,
'hide_account_balance_at_0': False,
'hierarchy_on': hierarchy_on,
'company_id': company.id,
'fy_start_date': self.fy_date_start,
'show_partner_details': with_partners,
})
trial_balance.compute_data_for_report()
lines = {}
report_account_model = self.env['report_trial_balance_account']
lines['receivable'] = report_account_model.search([
('report_id', '=', trial_balance.id),
('account_id', '=', self.account100.id),
])
lines['income'] = report_account_model.search([
('report_id', '=', trial_balance.id),
('account_id', '=', self.account200.id),
])
lines['unaffected'] = report_account_model.search([
('report_id', '=', trial_balance.id),
('account_id', '=', self.account110.id),
])
lines['group1'] = report_account_model.search([
('report_id', '=', trial_balance.id),
('account_group_id', '=', self.group1.id),
])
lines['group2'] = report_account_model.search([
('report_id', '=', trial_balance.id),
('account_group_id', '=', self.group2.id),
])
if with_partners:
report_partner_model = self.env[
'report_trial_balance_partner'
]
lines['partner_receivable'] = report_partner_model.search([
('report_account_id', '=', lines['receivable'].id),
('partner_id', '=', self.env.ref('base.res_partner_12').id),
])
return lines
def test_00_account_group(self):
self.assertEqual(len(self.group1.compute_account_ids.ids), 19)
self.assertEqual(len(self.group2.compute_account_ids.ids), 9)
def test_01_account_balance_computed(self):
# Generate the general ledger line
lines = self._get_report_lines()
self.assertEqual(len(lines['receivable']), 1)
self.assertEqual(len(lines['income']), 1)
# Add a move at the previous day of the first day of fiscal year
# to check the initial balance
self._add_move(
date=self.previous_fy_date_end,
receivable_debit=1000,
receivable_credit=0,
income_debit=0,
income_credit=1000
)
# Re Generate the trial balance line
lines = self._get_report_lines()
self.assertEqual(len(lines['receivable']), 1)
self.assertEqual(len(lines['income']), 1)
# Check the initial and final balance
self.assertEqual(lines['receivable'].initial_balance, 1000)
self.assertEqual(lines['receivable'].debit, 0)
self.assertEqual(lines['receivable'].credit, 0)
self.assertEqual(lines['receivable'].final_balance, 1000)
self.assertEqual(lines['group1'].initial_balance, 1000)
self.assertEqual(lines['group1'].debit, 0)
self.assertEqual(lines['group1'].credit, 0)
self.assertEqual(lines['group1'].final_balance, 1000)
# Add reversale move of the initial move the first day of fiscal year
# to check the first day of fiscal year is not used
# to compute the initial balance
self._add_move(
date=self.fy_date_start,
receivable_debit=0,
receivable_credit=1000,
income_debit=1000,
income_credit=0
)
# Re Generate the trial balance line
lines = self._get_report_lines()
self.assertEqual(len(lines['receivable']), 1)
self.assertEqual(len(lines['income']), 1)
# Check the initial and final balance
self.assertEqual(lines['receivable'].initial_balance, 1000)
self.assertEqual(lines['receivable'].debit, 0)
self.assertEqual(lines['receivable'].credit, 1000)
self.assertEqual(lines['receivable'].final_balance, 0)
self.assertEqual(lines['income'].initial_balance, 0)
self.assertEqual(lines['income'].debit, 1000)
self.assertEqual(lines['income'].credit, 0)
self.assertEqual(lines['income'].final_balance, 1000)
self.assertEqual(lines['group1'].initial_balance, 1000)
self.assertEqual(lines['group1'].debit, 0)
self.assertEqual(lines['group1'].credit, 1000)
self.assertEqual(lines['group1'].final_balance, 0)
self.assertEqual(lines['group2'].initial_balance, 0)
self.assertEqual(lines['group2'].debit, 1000)
self.assertEqual(lines['group2'].credit, 0)
self.assertEqual(lines['group2'].final_balance, 1000)
# Add another move at the end day of fiscal year
# to check that it correctly used on report
self._add_move(
date=self.fy_date_end,
receivable_debit=0,
receivable_credit=1000,
income_debit=1000,
income_credit=0
)
# Re Generate the trial balance line
lines = self._get_report_lines()
self.assertEqual(len(lines['receivable']), 1)
self.assertEqual(len(lines['income']), 1)
# Check the initial and final balance
self.assertEqual(lines['receivable'].initial_balance, 1000)
self.assertEqual(lines['receivable'].debit, 0)
self.assertEqual(lines['receivable'].credit, 2000)
self.assertEqual(lines['receivable'].final_balance, -1000)
self.assertEqual(lines['income'].initial_balance, 0)
self.assertEqual(lines['income'].debit, 2000)
self.assertEqual(lines['income'].credit, 0)
self.assertEqual(lines['income'].final_balance, 2000)
self.assertEqual(lines['group1'].initial_balance, 1000)
self.assertEqual(lines['group1'].debit, 0)
self.assertEqual(lines['group1'].credit, 2000)
self.assertEqual(lines['group1'].final_balance, -1000)
self.assertEqual(lines['group2'].initial_balance, 0)
self.assertEqual(lines['group2'].debit, 2000)
self.assertEqual(lines['group2'].credit, 0)
self.assertEqual(lines['group2'].final_balance, 2000)
self.assertEqual(len(lines['group2'].compute_account_ids), 2)
def test_02_account_balance_hierarchy(self):
# Generate the general ledger line
lines = self._get_report_lines(hierarchy_on='relation')
self.assertEqual(len(lines['receivable']), 1)
self.assertEqual(len(lines['income']), 1)
# Add a move at the previous day of the first day of fiscal year
# to check the initial balance
self._add_move(
date=self.previous_fy_date_end,
receivable_debit=1000,
receivable_credit=0,
income_debit=0,
income_credit=1000
)
# Re Generate the trial balance line
lines = self._get_report_lines(hierarchy_on='relation')
self.assertEqual(len(lines['receivable']), 1)
self.assertEqual(len(lines['income']), 1)
# Check the initial and final balance
self.assertEqual(lines['receivable'].initial_balance, 1000)
self.assertEqual(lines['receivable'].debit, 0)
self.assertEqual(lines['receivable'].credit, 0)
self.assertEqual(lines['receivable'].final_balance, 1000)
self.assertEqual(lines['group1'].initial_balance, 1000)
self.assertEqual(lines['group1'].debit, 0)
self.assertEqual(lines['group1'].credit, 0)
self.assertEqual(lines['group1'].final_balance, 1000)
# Add reversale move of the initial move the first day of fiscal year
# to check the first day of fiscal year is not used
# to compute the initial balance
self._add_move(
date=self.fy_date_start,
receivable_debit=0,
receivable_credit=1000,
income_debit=1000,
income_credit=0
)
# Re Generate the trial balance line
lines = self._get_report_lines(hierarchy_on='relation')
self.assertEqual(len(lines['receivable']), 1)
self.assertEqual(len(lines['income']), 1)
# Check the initial and final balance
self.assertEqual(lines['receivable'].initial_balance, 1000)
self.assertEqual(lines['receivable'].debit, 0)
self.assertEqual(lines['receivable'].credit, 1000)
self.assertEqual(lines['receivable'].final_balance, 0)
self.assertEqual(lines['income'].initial_balance, 0)
self.assertEqual(lines['income'].debit, 1000)
self.assertEqual(lines['income'].credit, 0)
self.assertEqual(lines['income'].final_balance, 1000)
self.assertEqual(lines['group1'].initial_balance, 1000)
self.assertEqual(lines['group1'].debit, 0)
self.assertEqual(lines['group1'].credit, 1000)
self.assertEqual(lines['group1'].final_balance, 0)
self.assertEqual(lines['group2'].initial_balance, 0)
self.assertEqual(lines['group2'].debit, 2000)
self.assertEqual(lines['group2'].credit, 0)
self.assertEqual(lines['group2'].final_balance, 2000)
self.assertEqual(len(lines['group2'].compute_account_ids), 2)
# Add another move at the end day of fiscal year
# to check that it correctly used on report
self._add_move(
date=self.fy_date_end,
receivable_debit=0,
receivable_credit=1000,
income_debit=1000,
income_credit=0
)
# Re Generate the trial balance line
lines = self._get_report_lines(hierarchy_on='relation')
self.assertEqual(len(lines['receivable']), 1)
self.assertEqual(len(lines['income']), 1)
# Check the initial and final balance
self.assertEqual(lines['receivable'].initial_balance, 1000)
self.assertEqual(lines['receivable'].debit, 0)
self.assertEqual(lines['receivable'].credit, 2000)
self.assertEqual(lines['receivable'].final_balance, -1000)
self.assertEqual(lines['income'].initial_balance, 0)
self.assertEqual(lines['income'].debit, 2000)
self.assertEqual(lines['income'].credit, 0)
self.assertEqual(lines['income'].final_balance, 2000)
self.assertEqual(lines['group1'].initial_balance, 1000)
self.assertEqual(lines['group1'].debit, 0)
self.assertEqual(lines['group1'].credit, 2000)
self.assertEqual(lines['group1'].final_balance, -1000)
self.assertEqual(lines['group2'].initial_balance, 0)
self.assertEqual(lines['group2'].debit, 4000)
self.assertEqual(lines['group2'].credit, 0)
self.assertEqual(lines['group2'].final_balance, 4000)
def test_03_partner_balance(self):
# Generate the trial balance line
lines = self._get_report_lines(with_partners=True)
self.assertEqual(len(lines['partner_receivable']), 0)
# Add a move at the previous day of the first day of fiscal year
# to check the initial balance
self._add_move(
date=self.previous_fy_date_end,
receivable_debit=1000,
receivable_credit=0,
income_debit=0,
income_credit=1000
)
# Re Generate the trial balance line
lines = self._get_report_lines(with_partners=True)
self.assertEqual(len(lines['partner_receivable']), 1)
# Check the initial and final balance
self.assertEqual(lines['partner_receivable'].initial_balance, 1000)
self.assertEqual(lines['partner_receivable'].debit, 0)
self.assertEqual(lines['partner_receivable'].credit, 0)
self.assertEqual(lines['partner_receivable'].final_balance, 1000)
# Add reversale move of the initial move the first day of fiscal year
# to check the first day of fiscal year is not used
# to compute the initial balance
self._add_move(
date=self.fy_date_start,
receivable_debit=0,
receivable_credit=1000,
income_debit=1000,
income_credit=0
)
# Re Generate the trial balance line
lines = self._get_report_lines(with_partners=True)
self.assertEqual(len(lines['partner_receivable']), 1)
# Check the initial and final balance
self.assertEqual(lines['partner_receivable'].initial_balance, 1000)
self.assertEqual(lines['partner_receivable'].debit, 0)
self.assertEqual(lines['partner_receivable'].credit, 1000)
self.assertEqual(lines['partner_receivable'].final_balance, 0)
# Add another move at the end day of fiscal year
# to check that it correctly used on report
self._add_move(
date=self.fy_date_end,
receivable_debit=0,
receivable_credit=1000,
income_debit=1000,
income_credit=0
)
# Re Generate the trial balance line
lines = self._get_report_lines(with_partners=True)
self.assertEqual(len(lines['partner_receivable']), 1)
# Check the initial and final balance
self.assertEqual(lines['partner_receivable'].initial_balance, 1000)
self.assertEqual(lines['partner_receivable'].debit, 0)
self.assertEqual(lines['partner_receivable'].credit, 2000)
self.assertEqual(lines['partner_receivable'].final_balance, -1000)

288
account_financial_report/tests/test_vat_report.py

@ -0,0 +1,288 @@
# Copyright 2018 Forest and Biomass Romania
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import time
from odoo.tests import common
from . import abstract_test_tax_report
class TestVAT(abstract_test_tax_report.AbstractTest):
"""
Technical tests for VAT Report.
"""
def _getReportModel(self):
return self.env['report_vat_report']
def _getQwebReportName(self):
return 'account_financial_report.report_vat_report_qweb'
def _getXlsxReportName(self):
return 'a_f_r.report_vat_report_xlsx'
def _getXlsxReportActionName(self):
return 'account_financial_report.action_report_vat_report_xlsx'
def _getReportTitle(self):
return 'Odoo'
def _getBaseFilters(self):
return {
'date_from': time.strftime('%Y-01-01'),
'date_to': time.strftime('%Y-12-31'),
'company_id': self.env.user.company_id.id
}
def _getAdditionalFiltersToBeTested(self):
return [
{'based_on': 'taxtags'},
{'based_on': 'taxgroups'},
{'tax_details': True},
{'based_on': 'taxtags', 'tax_details': True},
{'based_on': 'taxgroups', 'tax_details': True},
]
class TestVATReport(common.TransactionCase):
def setUp(self):
super(TestVATReport, self).setUp()
self.date_from = time.strftime('%Y-%m-01'),
self.date_to = time.strftime('%Y-%m-28'),
self.receivable_account = self.env['account.account'].search([
('user_type_id.name', '=', 'Receivable')
], limit=1)
self.income_account = self.env['account.account'].search([
('user_type_id.name', '=', 'Income')
], limit=1)
self.tax_account = self.env['account.account'].search([
('user_type_id',
'=',
self.env.ref(
'account.data_account_type_non_current_liabilities').id
)], limit=1)
self.bank_journal = self.env['account.journal'].search(
[('type', '=', 'bank')], limit=1)
self.tax_tag_01 = self.env['account.account.tag'].create({
'name': 'Tag 01',
'applicability': 'taxes'
})
self.tax_tag_02 = self.env['account.account.tag'].create({
'name': 'Tag 02',
'applicability': 'taxes'
})
self.tax_tag_03 = self.env['account.account.tag'].create({
'name': 'Tag 03',
'applicability': 'taxes'
})
self.tax_group_10 = self.env['account.tax.group'].create({
'name': 'Tax 10%',
'sequence': 1
})
self.tax_group_20 = self.env['account.tax.group'].create({
'name': 'Tax 20%',
'sequence': 2
})
self.tax_10 = self.env['account.tax'].create({
'name': 'Tax 10.0%',
'amount': 10.0,
'amount_type': 'percent',
'type_tax_use': 'sale',
'account_id': self.tax_account.id,
'refund_account_id': self.tax_account.id,
'tax_group_id': self.tax_group_10.id,
'tag_ids': [(6, 0, [self.tax_tag_01.id, self.tax_tag_02.id])]
})
self.tax_20 = self.env['account.tax'].create({
'sequence': 30,
'name': 'Tax 20.0%',
'amount': 20.0,
'amount_type': 'percent',
'type_tax_use': 'sale',
'tax_exigibility': 'on_payment',
'account_id': self.tax_account.id,
'refund_account_id': self.tax_account.id,
'cash_basis_account': self.tax_account.id,
'tax_group_id': self.tax_group_20.id,
'tag_ids': [(6, 0, [self.tax_tag_02.id, self.tax_tag_03.id])]
})
invoice = self.env['account.invoice'].create({
'partner_id': self.env.ref('base.res_partner_2').id,
'account_id': self.receivable_account.id,
'date_invoice': time.strftime('%Y-%m-03'),
'type': 'out_invoice',
})
self.env['account.invoice.line'].create({
'product_id': self.env.ref('product.product_product_4').id,
'quantity': 1.0,
'price_unit': 100.0,
'invoice_id': invoice.id,
'name': 'product',
'account_id': self.income_account.id,
'invoice_line_tax_ids': [(6, 0, [self.tax_10.id])],
})
invoice.compute_taxes()
invoice.action_invoice_open()
self.cbinvoice = self.env['account.invoice'].create({
'partner_id': self.env.ref('base.res_partner_2').id,
'account_id': self.receivable_account.id,
'date_invoice': time.strftime('%Y-%m-05'),
'type': 'out_invoice',
})
self.env['account.invoice.line'].create({
'product_id': self.env.ref('product.product_product_4').id,
'quantity': 1.0,
'price_unit': 500.0,
'invoice_id': self.cbinvoice.id,
'name': 'product',
'account_id': self.income_account.id,
'invoice_line_tax_ids': [(6, 0, [self.tax_20.id])],
})
self.cbinvoice.compute_taxes()
self.cbinvoice.action_invoice_open()
def _get_report_lines(self):
company = self.env.ref('base.main_company')
self.cbinvoice.pay_and_reconcile(
self.bank_journal.id, 300, time.strftime('%Y-%m-10'))
vat_report = self.env['report_vat_report'].create({
'date_from': self.date_from,
'date_to': self.date_to,
'company_id': company.id,
'based_on': 'taxtags',
'tax_detail': True,
})
vat_report.compute_data_for_report()
lines = {}
vat_taxtag_model = self.env['report_vat_report_taxtag']
lines['tag_01'] = vat_taxtag_model.search([
('report_id', '=', vat_report.id),
('taxtag_id', '=', self.tax_tag_01.id),
])
lines['tag_02'] = vat_taxtag_model.search([
('report_id', '=', vat_report.id),
('taxtag_id', '=', self.tax_tag_02.id),
])
lines['tag_03'] = vat_taxtag_model.search([
('report_id', '=', vat_report.id),
('taxtag_id', '=', self.tax_tag_03.id),
])
vat_tax_model = self.env['report_vat_report_tax']
lines['tax_10'] = vat_tax_model.search([
('report_tax_id', '=', lines['tag_02'].id),
('tax_id', '=', self.tax_10.id),
])
lines['tax_20'] = vat_tax_model.search([
('report_tax_id', '=', lines['tag_02'].id),
('tax_id', '=', self.tax_20.id),
])
vat_report['based_on'] = 'taxgroups'
vat_report.compute_data_for_report()
lines['group_10'] = vat_taxtag_model.search([
('report_id', '=', vat_report.id),
('taxgroup_id', '=', self.tax_group_10.id),
])
lines['group_20'] = vat_taxtag_model.search([
('report_id', '=', vat_report.id),
('taxgroup_id', '=', self.tax_group_20.id),
])
vat_tax_model = self.env['report_vat_report_tax']
lines['tax_group_10'] = vat_tax_model.search([
('report_tax_id', '=', lines['group_10'].id),
('tax_id', '=', self.tax_10.id),
])
lines['tax_group_20'] = vat_tax_model.search([
('report_tax_id', '=', lines['group_20'].id),
('tax_id', '=', self.tax_20.id),
])
return lines
def test_01_compute(self):
# Generate the vat lines
lines = self._get_report_lines()
# Check report based on taxtags
self.assertEqual(len(lines['tag_01']), 1)
self.assertEqual(len(lines['tag_02']), 1)
self.assertEqual(len(lines['tag_03']), 1)
self.assertEqual(len(lines['tax_10']), 1)
self.assertEqual(len(lines['tax_20']), 1)
self.assertEqual(lines['tag_01'].net, 100)
self.assertEqual(lines['tag_01'].tax, 10)
self.assertEqual(lines['tag_02'].net, 350)
self.assertEqual(lines['tag_02'].tax, 60)
self.assertEqual(lines['tag_03'].net, 250)
self.assertEqual(lines['tag_03'].tax, 50)
self.assertEqual(lines['tax_10'].net, 100)
self.assertEqual(lines['tax_10'].tax, 10)
self.assertEqual(lines['tax_20'].net, 250)
self.assertEqual(lines['tax_20'].tax, 50)
# Check report based on taxgroups
self.assertEqual(len(lines['group_10']), 1)
self.assertEqual(len(lines['group_20']), 1)
self.assertEqual(len(lines['tax_group_10']), 1)
self.assertEqual(len(lines['tax_group_20']), 1)
self.assertEqual(lines['group_10'].net, 100)
self.assertEqual(lines['group_10'].tax, 10)
self.assertEqual(lines['group_20'].net, 250)
self.assertEqual(lines['group_20'].tax, 50)
self.assertEqual(lines['tax_group_10'].net, 100)
self.assertEqual(lines['tax_group_10'].tax, 10)
self.assertEqual(lines['tax_group_20'].net, 250)
self.assertEqual(lines['tax_group_20'].tax, 50)
def test_get_report_html(self):
company = self.env.ref('base.main_company')
vat_report = self.env['report_vat_report'].create({
'date_from': self.date_from,
'date_to': self.date_to,
'company_id': company.id,
'tax_detail': True,
})
vat_report.compute_data_for_report()
vat_report.get_html(given_context={})
def test_wizard_date_range(self):
vat_wizard = self.env['vat.report.wizard']
date_range = self.env['date.range']
self.type = self.env['date.range.type'].create(
{'name': 'Month',
'company_id': False,
'allow_overlap': False})
dt = date_range.create({
'name': 'FS2016',
'date_start': time.strftime('%Y-%m-01'),
'date_end': time.strftime('%Y-%m-28'),
'type_id': self.type.id,
})
wizard = vat_wizard.create(
{'date_range_id': dt.id,
'date_from': time.strftime('%Y-%m-28'),
'date_to': time.strftime('%Y-%m-01'),
'tax_detail': True})
wizard.onchange_date_range_id()
self.assertEqual(wizard.date_from, time.strftime('%Y-%m-01'))
self.assertEqual(wizard.date_to, time.strftime('%Y-%m-28'))
wizard._export('qweb-pdf')
wizard.button_export_html()
wizard.button_export_pdf()
wizard.button_export_xlsx()
wizard = vat_wizard.create(
{'date_range_id': dt.id,
'date_from': time.strftime('%Y-%m-28'),
'date_to': time.strftime('%Y-%m-01'),
'based_on': 'taxgroups',
'tax_detail': True})
wizard.onchange_date_range_id()
self.assertEqual(wizard.date_from, time.strftime('%Y-%m-01'))
self.assertEqual(wizard.date_to, time.strftime('%Y-%m-28'))
wizard._export('qweb-pdf')
wizard.button_export_html()
wizard.button_export_pdf()
wizard.button_export_xlsx()

28
account_financial_report/view/account_view.xml

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="view_account_specific_form">
<field name="name">account.account.form.inherit</field>
<field name="inherit_id" ref="account.view_account_form"/>
@ -12,31 +11,4 @@
</field>
</field>
</record>
<record id="action_report_general_ledger" model="ir.actions.client">
<field name="name">General Ledger Report</field>
<field name="tag">report_general_ledger</field>
<field name="context" eval="{'model': 'report_general_ledger'}" />
</record>
<record id="action_report_trial_balance" model="ir.actions.client">
<field name="name">Trial Balance Report</field>
<field name="tag">report_trial_balance</field>
<field name="context" eval="{'model': 'report_trial_balance'}" />
</record>
<record id="action_report_open_items" model="ir.actions.client">
<field name="name">Open Items Report</field>
<field name="tag">report_open_items</field>
<field name="context" eval="{'model': 'report_open_items'}" />
</record>
<record id="action_report_aged_partner_balance" model="ir.actions.client">
<field name="name">Aged Partner Balance Report</field>
<field name="tag">report_aged_partner_balance</field>
<field name="context" eval="{'model': 'report_aged_partner_balance'}" />
</record>
</odoo>

6
account_financial_report/view/report_template.xml

@ -41,5 +41,11 @@
<field name="tag">account_financial_report_backend</field>
<field name="context" eval="{'active_model': 'report_aged_partner_balance'}" />
</record>
<record id="action_report_vat_report" model="ir.actions.client">
<field name="name">VAT Report</field>
<field name="tag">account_financial_report_backend</field>
<field name="context" eval="{'active_model': 'report_vat_report'}" />
</record>
</odoo>

4
account_financial_report/view/report_trial_balance.xml

@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_trial_balance">
<div class="o_account_financial_reports_page">
<t t-call="account_financial_report.report_buttons"/>
<t t-call="account_financial_report.report_trial_balance_base"/>
</div>
</template>
</odoo>
</odoo>

9
account_financial_report/view/report_vat_report.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_vat_report">
<div class="o_account_financial_reports_page">
<t t-call="account_financial_report.report_buttons"/>
<t t-call="account_financial_report.report_vat_report_base"/>
</div>
</template>
</odoo>

6
account_financial_report/wizard/__init__.py

@ -1,9 +1,5 @@
# Author: Damien Crier
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import aged_partner_balance_wizard
from . import general_ledger_wizard
from . import open_items_wizard
from . import trial_balance_wizard
from . import vat_report_wizard

1
account_financial_report/wizard/open_items_wizard.py

@ -1,4 +1,3 @@
# Author: Damien Crier
# Author: Julien Coux
# Copyright 2016 Camptocamp SA

9
account_financial_report/wizard/trial_balance_wizard.py

@ -1,4 +1,3 @@
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# Copyright 2017 Akretion - Alexis de Lattre
@ -32,6 +31,11 @@ class TrialBalanceReportWizard(models.TransientModel):
string='Target Moves',
required=True,
default='all')
hierarchy_on = fields.Selection([('computed', 'Computed Accounts'),
('relation', 'Child Accounts')],
string='Hierarchy On',
required=True,
default='computed')
account_ids = fields.Many2many(
comodel_name='account.account',
string='Filter accounts',
@ -100,8 +104,10 @@ class TrialBalanceReportWizard(models.TransientModel):
"""Handle partners change."""
if self.show_partner_details:
self.receivable_accounts_only = self.payable_accounts_only = True
self.hide_account_balance_at_0 = True
else:
self.receivable_accounts_only = self.payable_accounts_only = False
self.hide_account_balance_at_0 = False
@api.multi
def button_export_html(self):
@ -144,6 +150,7 @@ class TrialBalanceReportWizard(models.TransientModel):
'filter_account_ids': [(6, 0, self.account_ids.ids)],
'filter_partner_ids': [(6, 0, self.partner_ids.ids)],
'fy_start_date': self.fy_start_date,
'hierarchy_on': self.hierarchy_on,
'show_partner_details': self.show_partner_details,
}

1
account_financial_report/wizard/trial_balance_wizard_view.xml

@ -22,6 +22,7 @@
<field name="target_move" widget="radio"/>
<field name="hide_account_balance_at_0"/>
<field name="show_partner_details"/>
<field name="hierarchy_on" widget="radio" attrs="{'invisible':[('show_partner_details','=',True)]}"/>
</group>
</group>
<label for="partner_ids" attrs="{'invisible':[('show_partner_details','!=',True)]}"/>

80
account_financial_report/wizard/vat_report_wizard.py

@ -0,0 +1,80 @@
# Copyright 2018 Forest and Biomass Romania
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
from odoo.tools.safe_eval import safe_eval
from odoo.tools import pycompat
class VATReportWizard(models.TransientModel):
_name = "vat.report.wizard"
company_id = fields.Many2one(
comodel_name='res.company',
default=lambda self: self.env.user.company_id,
string='Company'
)
date_range_id = fields.Many2one(
comodel_name='date.range',
string='Date range'
)
date_from = fields.Date('Start Date', required=True)
date_to = fields.Date('End Date', required=True)
based_on = fields.Selection([('taxtags', 'Tax Tags'),
('taxgroups', 'Tax Groups')],
string='Based On',
required=True,
default='taxtags')
tax_detail = fields.Boolean('Detail Taxes')
@api.onchange('date_range_id')
def onchange_date_range_id(self):
"""Handle date range change."""
self.date_from = self.date_range_id.date_start
self.date_to = self.date_range_id.date_end
@api.multi
def button_export_html(self):
self.ensure_one()
action = self.env.ref(
'account_financial_report.action_report_vat_report')
vals = action.read()[0]
context1 = vals.get('context', {})
if isinstance(context1, pycompat.string_types):
context1 = safe_eval(context1)
model = self.env['report_vat_report']
report = model.create(self._prepare_vat_report())
report.compute_data_for_report()
context1['active_id'] = report.id
context1['active_ids'] = report.ids
vals['context'] = context1
return vals
@api.multi
def button_export_pdf(self):
self.ensure_one()
report_type = 'qweb-pdf'
return self._export(report_type)
@api.multi
def button_export_xlsx(self):
self.ensure_one()
report_type = 'xlsx'
return self._export(report_type)
def _prepare_vat_report(self):
self.ensure_one()
return {
'company_id': self.company_id.id,
'date_from': self.date_from,
'date_to': self.date_to,
'based_on': self.based_on,
'tax_detail': self.tax_detail,
}
def _export(self, report_type):
"""Default export is PDF."""
model = self.env['report_vat_report']
report = model.create(self._prepare_vat_report())
report.compute_data_for_report()
return report.print_report(report_type)

44
account_financial_report/wizard/vat_report_wizard_view.xml

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="vat_report_wizard" model="ir.ui.view">
<field name="name">vat_report_wizard_view</field>
<field name="model">vat.report.wizard</field>
<field name="arch" type="xml">
<form string="VAT Report Options">
<group name="main_info">
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
</group>
<group name="filters">
<group name="date_range">
<field name="date_range_id" domain="['|',('company_id','=',company_id), ('company_id','=',False)]"/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group name="other_filters">
<field name="based_on" widget="radio"/>
<field name="tax_detail"/>
</group>
</group>
<footer>
<button name="button_export_html" string="View"
type="object" default_focus="1" class="oe_highlight"/>
or
<button name="button_export_pdf" string="Export PDF" type="object"/>
or
<button name="button_export_xlsx" string="Export XLSX" type="object"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<act_window id="action_vat_report_wizard"
name="VAT Report"
res_model="vat.report.wizard"
view_type="form"
view_mode="form"
view_id="vat_report_wizard"
target="new" />
</odoo>
Loading…
Cancel
Save