Browse Source

dynamize general ledger

pull/367/head
Jordi Ballester 7 years ago
parent
commit
4cb36a903a
  1. 1
      .gitignore
  2. 7
      account_financial_report/__manifest__.py
  3. 1365
      account_financial_report/i18n/account_financial_report.pot
  4. 1365
      account_financial_report/i18n/account_financial_report_qweb.pot
  5. 1385
      account_financial_report/i18n/es.po
  6. 1386
      account_financial_report/i18n/fr.po
  7. 1376
      account_financial_report/i18n/hr_HR.po
  8. 1376
      account_financial_report/i18n/nl_NL.po
  9. 1385
      account_financial_report/i18n/pt.po
  10. 22
      account_financial_report/report/aged_partner_balance.py
  11. 17
      account_financial_report/report/general_ledger.py
  12. 17
      account_financial_report/report/open_items.py
  13. 225
      account_financial_report/report/templates/aged_partner_balance.xml
  14. 33
      account_financial_report/report/templates/general_ledger.xml
  15. 92
      account_financial_report/report/templates/open_items.xml
  16. 17
      account_financial_report/report/templates/trial_balance.xml
  17. 20
      account_financial_report/report/trial_balance.py
  18. 10
      account_financial_report/static/src/css/report.css
  19. 109
      account_financial_report/static/src/js/account_financial_report_backend.js
  20. 37
      account_financial_report/static/src/js/account_financial_report_widgets.js
  21. 2
      account_financial_report/tests/abstract_test.py
  22. 2
      account_financial_report/tests/test_aged_partner_balance.py
  23. 2
      account_financial_report/tests/test_general_ledger.py
  24. 2
      account_financial_report/tests/test_open_items.py
  25. 2
      account_financial_report/tests/test_trial_balance.py
  26. 28
      account_financial_report/view/account_view.xml
  27. 9
      account_financial_report/view/report_aged_partner_balance.xml
  28. 9
      account_financial_report/view/report_general_ledger.xml
  29. 9
      account_financial_report/view/report_open_items.xml
  30. 45
      account_financial_report/view/report_template.xml
  31. 9
      account_financial_report/view/report_trial_balance.xml
  32. 20
      account_financial_report/wizard/aged_partner_balance_wizard.py
  33. 24
      account_financial_report/wizard/general_ledger_wizard.py
  34. 19
      account_financial_report/wizard/open_items_wizard.py
  35. 19
      account_financial_report/wizard/trial_balance_wizard.py
  36. 2
      account_tax_balance/models/account_tax.py

1
.gitignore

@ -39,6 +39,7 @@ coverage.xml
# Pycharm
.idea
.vscode
# Mr Developer
.mr.developer.cfg

7
account_financial_report/__manifest__.py

@ -31,7 +31,12 @@
'report/templates/general_ledger.xml',
'report/templates/open_items.xml',
'report/templates/trial_balance.xml',
'view/account_view.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',
],
'installable': True,
'application': True,

1365
account_financial_report/i18n/account_financial_report.pot
File diff suppressed because it is too large
View File

1365
account_financial_report/i18n/account_financial_report_qweb.pot
File diff suppressed because it is too large
View File

1385
account_financial_report/i18n/es.po
File diff suppressed because it is too large
View File

1386
account_financial_report/i18n/fr.po
File diff suppressed because it is too large
View File

1376
account_financial_report/i18n/hr_HR.po
File diff suppressed because it is too large
View File

1376
account_financial_report/i18n/nl_NL.po
File diff suppressed because it is too large
View File

1385
account_financial_report/i18n/pt.po
File diff suppressed because it is too large
View File

22
account_financial_report/report/aged_partner_balance.py

@ -1,4 +1,3 @@
# © 2016 Julien Coux (Camptocamp)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
@ -39,7 +38,6 @@ class AgedPartnerBalanceReport(models.TransientModel):
class AgedPartnerBalanceReportAccount(models.TransientModel):
_name = 'report_aged_partner_balance_account'
_order = 'code ASC'
@ -82,7 +80,6 @@ class AgedPartnerBalanceReportAccount(models.TransientModel):
class AgedPartnerBalanceReportPartner(models.TransientModel):
_name = 'report_aged_partner_balance_partner'
report_account_id = fields.Many2one(
@ -126,7 +123,6 @@ ORDER BY
class AgedPartnerBalanceReportLine(models.TransientModel):
_name = 'report_aged_partner_balance_line'
report_partner_id = fields.Many2one(
@ -147,7 +143,6 @@ class AgedPartnerBalanceReportLine(models.TransientModel):
class AgedPartnerBalanceReportMoveLine(models.TransientModel):
_name = 'report_aged_partner_balance_move_line'
report_partner_id = fields.Many2one(
@ -187,7 +182,6 @@ class AgedPartnerBalanceReportCompute(models.TransientModel):
@api.multi
def print_report(self, report_type):
self.ensure_one()
self.compute_data_for_report()
if report_type == 'xlsx':
report_name = 'a_f_r.report_aged_partner_balance_xlsx'
else:
@ -198,6 +192,22 @@ class AgedPartnerBalanceReportCompute(models.TransientModel):
('report_type', '=', report_type)], limit=1)
return report.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_aged_partner_balance').render(
rcontext)
return result
@api.model
def get_html(self, given_context=None):
return self._get_html()
def _prepare_report_open_items(self):
self.ensure_one()
return {

17
account_financial_report/report/general_ledger.py

@ -198,7 +198,6 @@ class GeneralLedgerReportCompute(models.TransientModel):
@api.multi
def print_report(self, report_type):
self.ensure_one()
self.compute_data_for_report()
if report_type == 'xlsx':
report_name = 'a_f_r.report_general_ledger_xlsx'
else:
@ -208,6 +207,22 @@ class GeneralLedgerReportCompute(models.TransientModel):
[('report_name', '=', report_name),
('report_type', '=', report_type)], limit=1).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_general_ledger').render(
rcontext)
return result
@api.model
def get_html(self, given_context=None):
return self._get_html()
@api.multi
def compute_data_for_report(self,
with_line_details=True,

17
account_financial_report/report/open_items.py

@ -143,7 +143,6 @@ class OpenItemsReportCompute(models.TransientModel):
@api.multi
def print_report(self, report_type):
self.ensure_one()
self.compute_data_for_report()
if report_type == 'xlsx':
report_name = 'a_f_r.report_open_items_xlsx'
else:
@ -153,6 +152,22 @@ class OpenItemsReportCompute(models.TransientModel):
[('report_name', '=', report_name),
('report_type', '=', report_type)], limit=1).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_open_items').render(
rcontext)
return result
@api.model
def get_html(self, given_context=None):
return self._get_html()
@api.multi
def compute_data_for_report(self):
self.ensure_one()

225
account_financial_report/report/templates/aged_partner_balance.xml

@ -4,10 +4,17 @@
<template id="account_financial_report.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">
<t t-call="account_financial_report.report_aged_partner_balance_base"/>
</t>
</t>
</t>
</template>
<template id="account_financial_report.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"/>
<t t-call="account_financial_report.internal_layout">
<!-- Defines global variables used by internal layout -->
<t t-set="title">Aged Partner Balance</t>
<t t-set="company_name" t-value="o.company_id.name"/>
@ -21,7 +28,9 @@
<!-- Display account header -->
<div class="act_as_table list_table" style="margin-top: 10px;"/>
<div class="act_as_caption account_title" style="width: 1141px !important;">
<span t-field="account.code"/> - <span t-field="account.name"/>
<span t-field="account.code"/>
-
<span t-field="account.name"/>
</div>
<!-- Display account lines -->
@ -68,9 +77,6 @@
</div>
</t>
</div>
</t>
</t>
</t>
</template>
<template id="account_financial_report.report_aged_partner_balance_filters">
@ -121,21 +127,37 @@
<!-- # lines -->
<div class="act_as_row lines">
<!--## partner-->
<div class="act_as_cell left"><span t-field="line.partner"/></div>
<div class="act_as_cell left">
<span t-field="line.partner"/>
</div>
<!--## amount_residual-->
<div class="act_as_cell amount"><span t-field="line.amount_residual"/></div>
<div class="act_as_cell amount">
<span t-field="line.amount_residual"/>
</div>
<!--## current-->
<div class="act_as_cell amount"><span t-field="line.current"/></div>
<div class="act_as_cell amount">
<span t-field="line.current"/>
</div>
<!--## age_30_days-->
<div class="act_as_cell amount"><span t-field="line.age_30_days"/></div>
<div class="act_as_cell amount">
<span t-field="line.age_30_days"/>
</div>
<!--## age_60_days-->
<div class="act_as_cell amount"><span t-field="line.age_60_days"/></div>
<div class="act_as_cell amount">
<span t-field="line.age_60_days"/>
</div>
<!--## age_90_days-->
<div class="act_as_cell amount"><span t-field="line.age_90_days"/></div>
<div class="act_as_cell amount">
<span t-field="line.age_90_days"/>
</div>
<!--## age_120_days-->
<div class="act_as_cell amount"><span t-field="line.age_120_days"/></div>
<div class="act_as_cell amount">
<span t-field="line.age_120_days"/>
</div>
<!--## older-->
<div class="act_as_cell amount"><span t-field="line.older"/></div>
<div class="act_as_cell amount">
<span t-field="line.older"/>
</div>
</div>
</t>
</template>
@ -180,33 +202,61 @@
<!-- # 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">
<span t-field="line.date"/>
</div>
<!--## move-->
<div class="act_as_cell left"><span t-field="line.entry"/></div>
<div class="act_as_cell left">
<span t-field="line.entry"/>
</div>
<!--## journal-->
<div class="act_as_cell left"><span t-field="line.journal"/></div>
<div class="act_as_cell left">
<span t-field="line.journal"/>
</div>
<!--## account code-->
<div class="act_as_cell left"><span t-field="line.account"/></div>
<div class="act_as_cell left">
<span t-field="line.account"/>
</div>
<!--## partner-->
<div class="act_as_cell left"><span t-field="line.partner"/></div>
<div class="act_as_cell left">
<span t-field="line.partner"/>
</div>
<!--## ref - label-->
<div class="act_as_cell left"><span t-field="line.label"/></div>
<div class="act_as_cell left">
<span t-field="line.label"/>
</div>
<!--## date_due-->
<div class="act_as_cell left"><span t-field="line.date_due"/></div>
<div class="act_as_cell left">
<span t-field="line.date_due"/>
</div>
<!--## amount_residual-->
<div class="act_as_cell amount"><span t-field="line.amount_residual"/></div>
<div class="act_as_cell amount">
<span t-field="line.amount_residual"/>
</div>
<!--## current-->
<div class="act_as_cell amount"><span t-field="line.current"/></div>
<div class="act_as_cell amount">
<span t-field="line.current"/>
</div>
<!--## age_30_days-->
<div class="act_as_cell amount"><span t-field="line.age_30_days"/></div>
<div class="act_as_cell amount">
<span t-field="line.age_30_days"/>
</div>
<!--## age_60_days-->
<div class="act_as_cell amount"><span t-field="line.age_60_days"/></div>
<div class="act_as_cell amount">
<span t-field="line.age_60_days"/>
</div>
<!--## age_90_days-->
<div class="act_as_cell amount"><span t-field="line.age_90_days"/></div>
<div class="act_as_cell amount">
<span t-field="line.age_90_days"/>
</div>
<!--## age_120_days-->
<div class="act_as_cell amount"><span t-field="line.age_120_days"/></div>
<div class="act_as_cell amount">
<span t-field="line.age_120_days"/>
</div>
<!--## older-->
<div class="act_as_cell amount"><span t-field="line.older"/></div>
<div class="act_as_cell amount">
<span t-field="line.older"/>
</div>
</div>
</t>
</div>
@ -221,19 +271,33 @@
<!--## date_due-->
<div class="act_as_cell" style="width: 60px;"/>
<!--## amount_residual-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="partner_cumul_line.amount_residual"/></div>
<div class="act_as_cell amount" style="width: 70px;">
<span t-field="partner_cumul_line.amount_residual"/>
</div>
<!--## current-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="partner_cumul_line.current"/></div>
<div class="act_as_cell amount" style="width: 70px;">
<span t-field="partner_cumul_line.current"/>
</div>
<!--## age_30_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="partner_cumul_line.age_30_days"/></div>
<div class="act_as_cell amount" style="width: 70px;">
<span t-field="partner_cumul_line.age_30_days"/>
</div>
<!--## age_60_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="partner_cumul_line.age_60_days"/></div>
<div class="act_as_cell amount" style="width: 70px;">
<span t-field="partner_cumul_line.age_60_days"/>
</div>
<!--## age_90_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="partner_cumul_line.age_90_days"/></div>
<div class="act_as_cell amount" style="width: 70px;">
<span t-field="partner_cumul_line.age_90_days"/>
</div>
<!--## age_120_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="partner_cumul_line.age_120_days"/></div>
<div class="act_as_cell amount" style="width: 70px;">
<span t-field="partner_cumul_line.age_120_days"/>
</div>
<!--## older-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="partner_cumul_line.older"/></div>
<div class="act_as_cell amount" style="width: 70px;">
<span t-field="partner_cumul_line.older"/>
</div>
</div>
</div>
</template>
@ -246,19 +310,33 @@
<!--## total-->
<div class="act_as_cell right" style="width: 370px;">Total</div>
<!--## amount_residual-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.cumul_amount_residual"/></div>
<div class="act_as_cell amount" style="width: 110px;">
<span t-field="account.cumul_amount_residual"/>
</div>
<!--## current-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.cumul_current"/></div>
<div class="act_as_cell amount" style="width: 110px;">
<span t-field="account.cumul_current"/>
</div>
<!--## age_30_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.cumul_age_30_days"/></div>
<div class="act_as_cell amount" style="width: 110px;">
<span t-field="account.cumul_age_30_days"/>
</div>
<!--## age_60_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.cumul_age_60_days"/></div>
<div class="act_as_cell amount" style="width: 110px;">
<span t-field="account.cumul_age_60_days"/>
</div>
<!--## age_90_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.cumul_age_90_days"/></div>
<div class="act_as_cell amount" style="width: 110px;">
<span t-field="account.cumul_age_90_days"/>
</div>
<!--## age_120_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.cumul_age_120_days"/></div>
<div class="act_as_cell amount" style="width: 110px;">
<span t-field="account.cumul_age_120_days"/>
</div>
<!--## older-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.cumul_older"/></div>
<div class="act_as_cell amount" style="width: 110px;">
<span t-field="account.cumul_older"/>
</div>
</t>
<t t-if="show_move_line_details">
<!--## total-->
@ -266,19 +344,33 @@
<!--## date_due-->
<div class="act_as_cell" style="width: 60px;"/>
<!--## amount_residual-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.cumul_amount_residual"/></div>
<div class="act_as_cell amount" style="width: 70px;">
<span t-field="account.cumul_amount_residual"/>
</div>
<!--## current-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.cumul_current"/></div>
<div class="act_as_cell amount" style="width: 70px;">
<span t-field="account.cumul_current"/>
</div>
<!--## age_30_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.cumul_age_30_days"/></div>
<div class="act_as_cell amount" style="width: 70px;">
<span t-field="account.cumul_age_30_days"/>
</div>
<!--## age_60_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.cumul_age_60_days"/></div>
<div class="act_as_cell amount" style="width: 70px;">
<span t-field="account.cumul_age_60_days"/>
</div>
<!--## age_90_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.cumul_age_90_days"/></div>
<div class="act_as_cell amount" style="width: 70px;">
<span t-field="account.cumul_age_90_days"/>
</div>
<!--## age_120_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.cumul_age_120_days"/></div>
<div class="act_as_cell amount" style="width: 70px;">
<span t-field="account.cumul_age_120_days"/>
</div>
<!--## older-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.cumul_older"/></div>
<div class="act_as_cell amount" style="width: 70px;">
<span t-field="account.cumul_older"/>
</div>
</t>
</div>
<div class="act_as_row" style="font-weight: bold; font-style: italic;">
@ -288,17 +380,24 @@
<!--## amount_residual-->
<div class="act_as_cell amount" style="width: 110px;"/>
<!--## current-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_current"/>%</div>
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_current"/>%
</div>
<!--## age_30_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_age_30_days"/>%</div>
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_age_30_days"/>%
</div>
<!--## age_60_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_age_60_days"/>%</div>
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_age_60_days"/>%
</div>
<!--## age_90_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_age_90_days"/>%</div>
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_age_90_days"/>%
</div>
<!--## age_120_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_age_120_days"/>%</div>
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_age_120_days"/>
%
</div>
<!--## older-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_older"/>%</div>
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_older"/>%
</div>
</t>
<t t-if="show_move_line_details">
<!--## total-->
@ -308,17 +407,23 @@
<!--## amount_residual-->
<div class="act_as_cell amount" style="width: 70px;"/>
<!--## current-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_current"/>%</div>
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_current"/>%
</div>
<!--## age_30_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_age_30_days"/>%</div>
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_age_30_days"/>%
</div>
<!--## age_60_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_age_60_days"/>%</div>
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_age_60_days"/>%
</div>
<!--## age_90_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_age_90_days"/>%</div>
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_age_90_days"/>%
</div>
<!--## age_120_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_age_120_days"/>%</div>
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_age_120_days"/>%
</div>
<!--## older-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_older"/>%</div>
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_older"/>%
</div>
</t>
</div>
</div>

33
account_financial_report/report/templates/general_ledger.xml

@ -4,10 +4,17 @@
<template id="report_general_ledger_qweb">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="account_financial_report.internal_layout">
<t t-call="account_financial_report.report_general_ledger_base"/>
</t>
</t>
</t>
</template>
<template id="report_general_ledger_base">
<!-- Saved flag fields into variables, used to define columns display -->
<t t-set="show_cost_center" t-value="o.show_cost_center"/>
<t t-set="has_second_currency" t-value="o.has_second_currency"/>
<t t-call="account_financial_report.internal_layout">
<!-- Defines global variables used by internal layout -->
<t t-set="title">General Ledger</t>
<t t-set="company_name" t-value="o.company_id.name"/>
@ -62,9 +69,6 @@
</div>
</t>
</div>
</t>
</t>
</t>
</template>
<template id="account_financial_report.report_general_ledger_filters">
@ -171,13 +175,30 @@
<!--## date-->
<div class="act_as_cell left"><span t-field="line.date"/></div>
<!--## move-->
<div class="act_as_cell left"><span t-field="line.entry"/></div>
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.move'"/>
<span>
<a t-att-data-active-id="line.move_line_id.move_id.id"
t-att-data-res-model="res_model"
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"/></div>
<!--## account code-->
<div class="act_as_cell left"><span t-field="line.account"/></div>
<!--## partner-->
<div class="act_as_cell left"><span t-field="line.partner"/></div>
<div class="act_as_cell left">
<t t-set="res_model" t-value="'res.partner'"/>
<span t-if="line.partner">
<a t-att-data-active-id="line.move_line_id.partner_id.id"
t-att-data-res-model="res_model"
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"/></div>
<t t-if="show_cost_center">

92
account_financial_report/report/templates/open_items.xml

@ -4,10 +4,18 @@
<template id="account_financial_report.report_open_items_qweb">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="account_financial_report.internal_layout">
<t t-call="account_financial_report.report_open_items_base"/>
</t>
</t>
</t>
</template>
<template id="account_financial_report.report_open_items_base">
<!-- Saved flag fields into variables, used to define columns display -->
<t t-set="has_second_currency" t-value="o.has_second_currency"/>
<t t-call="account_financial_report.internal_layout">
<!-- Defines global variables used by internal layout -->
<t t-set="title">Open Items</t>
<t t-set="company_name" t-value="o.company_id.name"/>
@ -21,7 +29,9 @@
<!-- Display account header -->
<div class="act_as_table list_table" style="margin-top: 10px;"/>
<div class="act_as_caption account_title" style="width: 1141px !important;">
<span t-field="account.code"/> - <span t-field="account.name"/>
<span t-field="account.code"/>
-
<span t-field="account.name"/>
</div>
<!-- Display account partners -->
@ -51,12 +61,8 @@
</div>
</t>
</div>
</t>
</t>
</t>
</template>
<template id="account_financial_report.report_open_items_filters">
<div class="act_as_table data_table" style="width: 1140px !important;">
<div class="act_as_row labels">
@ -117,30 +123,70 @@
<!-- # 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">
<span t-field="line.date"/>
</div>
<!--## move-->
<div class="act_as_cell left"><span t-field="line.entry"/></div>
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.move'"/>
<span>
<a t-att-data-active-id="line.move_line_id.move_id.id"
t-att-data-res-model="res_model"
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"/></div>
<div class="act_as_cell left">
<span t-field="line.journal"/>
</div>
<!--## account code-->
<div class="act_as_cell left"><span t-field="line.account"/></div>
<div class="act_as_cell left">
<span t-field="line.account"/>
</div>
<!--## partner-->
<div class="act_as_cell left"><span t-field="line.partner"/></div>
<div class="act_as_cell left">
<t t-set="res_model" t-value="'res.partner'"/>
<span t-if="line.partner">
<a t-att-data-active-id="line.move_line_id.partner_id.id"
t-att-data-res-model="res_model"
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"/></div>
<div class="act_as_cell left">
<span t-field="line.label"/>
</div>
<!--## date_due-->
<div class="act_as_cell left"><span t-field="line.date_due"/></div>
<div class="act_as_cell left">
<span t-field="line.date_due"/>
</div>
<!--## amount_total_due-->
<div class="act_as_cell amount"><span t-field="line.amount_total_due"/></div>
<div class="act_as_cell amount">
<span t-field="line.amount_total_due"/>
</div>
<!--## amount_residual-->
<div class="act_as_cell amount"><span t-field="line.amount_residual"/></div>
<div class="act_as_cell amount">
<span t-field="line.amount_residual"/>
</div>
<!--## currency_name-->
<div class="act_as_cell"><span t-field="line.currency_name"/></div>
<div class="act_as_cell">
<span t-field="line.currency_name"/>
</div>
<t t-if="line.currency_name">
<!--## amount_total_due_currency-->
<div class="act_as_cell amount"><span t-field="line.amount_total_due_currency"/></div>
<div class="act_as_cell amount">
<span t-field="line.amount_total_due_currency"/>
</div>
<!--## amount_residual_currency-->
<div class="act_as_cell amount"><span t-field="line.amount_residual_currency"/></div>
<div class="act_as_cell amount">
<span t-field="line.amount_residual_currency"/>
</div>
</t>
<t t-if="not line.currency_name">
<!--## amount_total_due_currency-->
@ -159,7 +205,11 @@
<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: 380px;"><span t-field="account_or_partner_object.code"/> - <span t-field="account_or_partner_object.name"/></div>
<div class="act_as_cell first_column" style="width: 380px;">
<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: 290px;">Ending balance</div>
</t>
<t t-if='type == "partner_type"'>
@ -171,7 +221,9 @@
<!--## amount_total_due-->
<div class="act_as_cell amount" style="width: 75px;"/>
<!--## amount_currency-->
<div class="act_as_cell amount" style="width: 75px;"><span t-field="account_or_partner_object.final_amount_residual"/></div>
<div class="act_as_cell amount" style="width: 75px;">
<span t-field="account_or_partner_object.final_amount_residual"/>
</div>
<!--## currency_name + amount_total_due_currency + amount_residual_currency -->
<div class="act_as_cell" style="width: 185px;"/>
</div>

17
account_financial_report/report/templates/trial_balance.xml

@ -4,14 +4,19 @@
<template id="account_financial_report.report_trial_balance_qweb">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="account_financial_report.internal_layout">
<t t-call="account_financial_report.report_trial_balance_base"/>
</t>
</t>
</t>
</template>
<template id="account_financial_report.report_trial_balance_base">
<!-- Saved flag fields into variables, used to define columns display -->
<t t-set="show_partner_details" t-value="o.show_partner_details"/>
<t t-call="account_financial_report.internal_layout">
<!-- Defines global variables used by internal layout -->
<t t-set="title">Trial Balance</t>
<t t-set="company_name" t-value="o.company_id.name"/>
<div class="page">
<!-- Display filters -->
<t t-call="account_financial_report.report_trial_balance_filters"/>
@ -56,12 +61,8 @@
<t t-call="account_financial_report.report_trial_balance_account_footer"/>
</div>
</t>
</t>
</div>
</t>
</t>
</t>
</template>
<template id="account_financial_report.report_trial_balance_filters">
@ -99,7 +100,7 @@
</t>
<t t-if="show_partner_details">
<!--## Partner-->
/<div class="act_as_cell" style="width: 700px;">Partner</div>
<div class="act_as_cell" style="width: 700px;">Partner</div>
</t>
<!--## Initial balance-->
<div class="act_as_cell" style="width: 110px;">Initial balance</div>

20
account_financial_report/report/trial_balance.py

@ -1,4 +1,3 @@
# © 2016 Julien Coux (Camptocamp)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
@ -43,7 +42,6 @@ class TrialBalanceReport(models.TransientModel):
class TrialBalanceReportAccount(models.TransientModel):
_name = 'report_trial_balance_account'
_order = 'code ASC'
@ -76,7 +74,6 @@ class TrialBalanceReportAccount(models.TransientModel):
class TrialBalanceReportPartner(models.TransientModel):
_name = 'report_trial_balance_partner'
report_account_id = fields.Many2one(
@ -123,7 +120,6 @@ class TrialBalanceReportCompute(models.TransientModel):
@api.multi
def print_report(self, report_type):
self.ensure_one()
self.compute_data_for_report()
if report_type == 'xlsx':
report_name = 'a_f_r.report_trial_balance_xlsx'
else:
@ -133,6 +129,22 @@ class TrialBalanceReportCompute(models.TransientModel):
[('report_name', '=', report_name),
('report_type', '=', report_type)], limit=1).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_trial_balance').render(
rcontext)
return result
@api.model
def get_html(self, given_context=None):
return self._get_html()
def _prepare_report_general_ledger(self):
self.ensure_one()
return {

10
account_financial_report/static/src/css/report.css

@ -93,3 +93,13 @@ body, table, td, span, div {
.page_break {
page-break-inside: avoid;
}
.button_row {
padding-bottom: 10px;
}
.o_account_financial_reports_page {
background-color: @odoo-view-background-color;
color: @odoo-main-text-color;
padding-top: 10px;
}

109
account_financial_report/static/src/js/account_financial_report_backend.js

@ -0,0 +1,109 @@
odoo.define('account_financial_report.account_financial_report_backend', function (require) {
'use strict';
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.
events: {
'click .o_account_financial_reports_print': 'print',
'click .o_account_financial_reports_export': 'export',
},
init: function(parent, action) {
this.actionManager = parent;
this.given_context = {};
this.odoo_context = action.context;
this.controller_url = action.context.url;
if (action.context.context) {
this.given_context = action.context.context;
}
this.given_context.active_id = action.context.active_id || action.params.active_id;
this.given_context.model = action.context.active_model || false;
this.given_context.ttype = action.context.ttype || false;
return this._super.apply(this, arguments);
},
willStart: function() {
return $.when(this.get_html());
},
set_html: function() {
var self = this;
var def = $.when();
if (!this.report_widget) {
this.report_widget = new ReportWidget(this, this.given_context);
def = this.report_widget.appendTo(this.$el);
}
def.then(function () {
self.report_widget.$el.html(self.html);
});
},
start: function() {
this.set_html();
return this._super();
},
// Fetches the html and is previous report.context if any, else create it
get_html: function() {
var self = this;
var defs = [];
return this._rpc({
model: this.given_context.model,
method: 'get_html',
args: [self.given_context],
context: self.odoo_context,
})
.then(function (result) {
self.html = result.html;
defs.push(self.update_cp());
return $.when.apply($, defs);
});
},
// Updates the control panel and render the elements that have yet to be rendered
update_cp: function() {
if (!this.$buttons) {
}
var status = {
breadcrumbs: this.actionManager.get_breadcrumbs(),
cp_content: {$buttons: this.$buttons},
};
return this.update_control_panel(status);
},
do_show: function() {
this._super();
this.update_cp();
},
print: function(e) {
var self = this;
this._rpc({
model: this.given_context.model,
method: 'print_report',
args: [this.given_context.active_id, 'qweb-pdf'],
context: self.odoo_context,
}).then(function(result){
self.do_action(result);
});
},
export: function(e) {
var self = this;
this._rpc({
model: this.given_context.model,
method: 'print_report',
args: [this.given_context.active_id, 'xlsx'],
context: self.odoo_context,
})
.then(function(result){
self.do_action(result);
});
},
});
core.action_registry.add("account_financial_report_backend", report_backend);
return report_backend;
});

37
account_financial_report/static/src/js/account_financial_report_widgets.js

@ -0,0 +1,37 @@
odoo.define('account_financial_report.account_financial_report_widget', function
(require) {
'use strict';
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',
},
init: function(parent) {
this._super.apply(this, arguments);
},
start: function() {
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')
return this.do_action({
type: 'ir.actions.act_window',
res_model: res_model,
res_id: res_id,
views: [[false, 'form']],
target: 'current'
});
},
});
return accountFinancialReportWidget;
});

2
account_financial_report/tests/abstract_test.py

@ -31,6 +31,7 @@ class AbstractTest(TransactionCase):
cls.additional_filters = cls._getAdditionalFiltersToBeTested()
cls.report = cls.model.create(cls.base_filters)
cls.report.compute_data_for_report()
def test_01_generation_report_qweb(self):
"""Check if report PDF/HTML is correctly generated"""
@ -56,6 +57,7 @@ class AbstractTest(TransactionCase):
rep = report.render(self.report.ids, {})
self.assertTrue(self.report_title.encode('utf8') in rep[0])
self.assertTrue(
self.report.account_ids[0].name.encode('utf8') in rep[0]
)

2
account_financial_report/tests/test_aged_partner_balance.py

@ -26,7 +26,7 @@ class TestAgedPartnerBalance(abstract_test.AbstractTest):
'action_report_aged_partner_balance_xlsx'
def _getReportTitle(self):
return 'Aged Partner Balance'
return 'Odoo Report'
def _getBaseFilters(self):
return {

2
account_financial_report/tests/test_general_ledger.py

@ -27,7 +27,7 @@ class TestGeneralLedger(abstract_test.AbstractTest):
'action_report_general_ledger_xlsx'
def _getReportTitle(self):
return 'General Ledger'
return 'Odoo Report'
def _getBaseFilters(self):
return {

2
account_financial_report/tests/test_open_items.py

@ -25,7 +25,7 @@ class TestOpenItems(abstract_test.AbstractTest):
return 'account_financial_report.action_report_open_items_xlsx'
def _getReportTitle(self):
return 'Open Items'
return 'Odoo Report'
def _getBaseFilters(self):
return {

2
account_financial_report/tests/test_trial_balance.py

@ -25,7 +25,7 @@ class TestTrialBalance(abstract_test.AbstractTest):
return 'account_financial_report.action_report_trial_balance_xlsx'
def _getReportTitle(self):
return 'Trial Balance'
return 'Odoo Report'
def _getBaseFilters(self):
return {

28
account_financial_report/view/account_view.xml

@ -1,5 +1,6 @@
<?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"/>
@ -11,4 +12,31 @@
</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>

9
account_financial_report/view/report_aged_partner_balance.xml

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

9
account_financial_report/view/report_general_ledger.xml

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

9
account_financial_report/view/report_open_items.xml

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

45
account_financial_report/view/report_template.xml

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="account_financial_report_assets_backend"
name="account_financial_report assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link href="/account_financial_report/static/src/css/report.css" rel="stylesheet"/>
<script type="text/javascript"
src="/account_financial_report/static/src/js/account_financial_report_backend.js"/>
<script type="text/javascript"
src="/account_financial_report/static/src/js/account_financial_report_widgets.js"/>
</xpath>
</template>
<template id="report_buttons">
<div class="button_row">
<button class="o_account_financial_reports_print btn btn-sm oe_button"><span class="fa fa-print"/> Print</button>
<button class="o_account_financial_reports_export btn btn-sm oe_button"><span class="fa fa-download"/> Export</button>
</div>
</template>
<record id="action_report_general_ledger" model="ir.actions.client">
<field name="name">General Ledger</field>
<field name="tag">account_financial_report_backend</field>
<field name="context" eval="{'active_model': 'report_general_ledger'}" />
</record>
<record id="action_report_open_items" model="ir.actions.client">
<field name="name">Open Items</field>
<field name="tag">account_financial_report_backend</field>
<field name="context" eval="{'active_model': 'report_open_items'}" />
</record>
<record id="action_report_trial_balance" model="ir.actions.client">
<field name="name">Trial Balance</field>
<field name="tag">account_financial_report_backend</field>
<field name="context" eval="{'active_model': 'report_trial_balance'}" />
</record>
<record id="action_report_aged_partner_balance" model="ir.actions.client">
<field name="name">Aged Partner Balance</field>
<field name="tag">account_financial_report_backend</field>
<field name="context" eval="{'active_model': 'report_aged_partner_balance'}" />
</record>
</odoo>

9
account_financial_report/view/report_trial_balance.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_trial_balance">
<div class="container 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>

20
account_financial_report/wizard/aged_partner_balance_wizard.py

@ -1,4 +1,3 @@
# Author: Damien Crier, Andrea Stirpe, Kevin Graveman, Dennis Sluijk
# Author: Julien Coux
# Copyright 2016 Camptocamp SA, Onestein B.V.
@ -6,6 +5,8 @@
from datetime import datetime
from odoo import api, fields, models
from odoo.tools.safe_eval import safe_eval
from odoo.tools import pycompat
class AgedPartnerBalance(models.TransientModel):
@ -56,8 +57,20 @@ class AgedPartnerBalance(models.TransientModel):
@api.multi
def button_export_html(self):
self.ensure_one()
report_type = 'qweb-html'
return self._export(report_type)
action = self.env.ref(
'account_financial_report.action_report_aged_partner_balance')
vals = action.read()[0]
context1 = vals.get('context', {})
if isinstance(context1, pycompat.string_types):
context1 = safe_eval(context1)
model = self.env['report_aged_partner_balance']
report = model.create(self._prepare_report_aged_partner_balance())
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):
@ -86,4 +99,5 @@ class AgedPartnerBalance(models.TransientModel):
"""Default export is PDF."""
model = self.env['report_aged_partner_balance']
report = model.create(self._prepare_report_aged_partner_balance())
report.compute_data_for_report()
return report.print_report(report_type)

24
account_financial_report/wizard/general_ledger_wizard.py

@ -1,11 +1,15 @@
# Author: Damien Crier
# Author: Julien Coux
# Author: Jordi Ballester
# Copyright 2016 Camptocamp SA
# Copyright 2017 Akretion - Alexis de Lattre
# Copyright 2017 Eficent Business and IT Consulting Services, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api
from odoo import api, fields, models
from odoo.tools.safe_eval import safe_eval
from odoo.tools import pycompat
class GeneralLedgerReportWizard(models.TransientModel):
@ -110,8 +114,19 @@ class GeneralLedgerReportWizard(models.TransientModel):
@api.multi
def button_export_html(self):
self.ensure_one()
report_type = 'qweb-html'
return self._export(report_type)
action = self.env.ref(
'account_financial_report.action_report_general_ledger')
vals = action.read()[0]
context1 = vals.get('context', {})
if isinstance(context1, pycompat.string_types):
context1 = safe_eval(context1)
model = self.env['report_general_ledger']
report = model.create(self._prepare_report_general_ledger())
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):
@ -144,4 +159,5 @@ class GeneralLedgerReportWizard(models.TransientModel):
"""Default export is PDF."""
model = self.env['report_general_ledger']
report = model.create(self._prepare_report_general_ledger())
report.compute_data_for_report()
return report.print_report(report_type)

19
account_financial_report/wizard/open_items_wizard.py

@ -6,6 +6,8 @@
from datetime import datetime
from odoo import models, fields, api
from odoo.tools.safe_eval import safe_eval
from odoo.tools import pycompat
class OpenItemsReportWizard(models.TransientModel):
@ -63,8 +65,20 @@ class OpenItemsReportWizard(models.TransientModel):
@api.multi
def button_export_html(self):
self.ensure_one()
report_type = 'qweb-html'
return self._export(report_type)
action = self.env.ref(
'account_financial_report.action_report_open_items')
vals = action.read()[0]
context1 = vals.get('context', {})
if isinstance(context1, pycompat.string_types):
context1 = safe_eval(context1)
model = self.env['report_open_items']
report = model.create(self._prepare_report_open_items())
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):
@ -93,4 +107,5 @@ class OpenItemsReportWizard(models.TransientModel):
"""Default export is PDF."""
model = self.env['report_open_items']
report = model.create(self._prepare_report_open_items())
report.compute_data_for_report()
return report.print_report(report_type)

19
account_financial_report/wizard/trial_balance_wizard.py

@ -5,6 +5,8 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api
from odoo.tools.safe_eval import safe_eval
from odoo.tools import pycompat
class TrialBalanceReportWizard(models.TransientModel):
@ -104,8 +106,20 @@ class TrialBalanceReportWizard(models.TransientModel):
@api.multi
def button_export_html(self):
self.ensure_one()
report_type = 'qweb-html'
return self._export(report_type)
action = self.env.ref(
'account_financial_report.action_report_trial_balance')
vals = action.read()[0]
context1 = vals.get('context', {})
if isinstance(context1, pycompat.string_types):
context1 = safe_eval(context1)
model = self.env['report_trial_balance']
report = model.create(self._prepare_report_trial_balance())
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):
@ -137,4 +151,5 @@ class TrialBalanceReportWizard(models.TransientModel):
"""Default export is PDF."""
model = self.env['report_trial_balance']
report = model.create(self._prepare_report_trial_balance())
report.compute_data_for_report()
return report.print_report(report_type)

2
account_tax_balance/models/account_tax.py

@ -39,7 +39,7 @@ class AccountTax(models.Model):
context.get('from_date', fields.Date.context_today(self)),
context.get('to_date', fields.Date.context_today(self)),
context.get('company_id', self.env.user.company_id.id),
context.get('target_move', 'posted')
context.get('target_move', 'posted'),
)
def _account_tax_ids_with_moves(self):

Loading…
Cancel
Save