Browse Source

[FIX] account_financial_report: Actions

pull/764/head
Alexandre D. Díaz 3 years ago
parent
commit
f19ce93542
  1. 1
      account_financial_report/README.rst
  2. 1
      account_financial_report/__manifest__.py
  3. 1
      account_financial_report/readme/CONTRIBUTORS.rst
  4. 330
      account_financial_report/report/templates/aged_partner_balance.xml
  5. 453
      account_financial_report/report/templates/general_ledger.xml
  6. 16
      account_financial_report/report/templates/journal_ledger.xml
  7. 2
      account_financial_report/report/templates/layouts.xml
  8. 16
      account_financial_report/report/templates/open_items.xml
  9. 529
      account_financial_report/report/templates/trial_balance.xml
  10. 157
      account_financial_report/report/templates/vat_report.xml
  11. 1
      account_financial_report/static/description/index.html
  12. 6
      account_financial_report/static/src/css/report.css
  13. 109
      account_financial_report/static/src/js/account_financial_report_backend.js
  14. 88
      account_financial_report/static/src/js/account_financial_report_widgets.js
  15. 35
      account_financial_report/static/src/js/action_manager_report.js
  16. 58
      account_financial_report/static/src/js/client_action.js
  17. 58
      account_financial_report/static/src/js/report.js
  18. 17
      account_financial_report/static/src/xml/report.xml
  19. 80
      account_financial_report/view/report_template.xml

1
account_financial_report/README.rst

@ -129,6 +129,7 @@ Contributors
* Sergio Teruel
* Ernesto Tejeda
* João Marques
* Alexandre D. Díaz
Much of the work in this module was done at a sprint in Sorrento, Italy in
April 2016.

1
account_financial_report/__manifest__.py

@ -42,6 +42,7 @@
"view/report_aged_partner_balance.xml",
"view/report_vat_report.xml",
],
"qweb": ["static/src/xml/report.xml"],
"installable": True,
"application": True,
"auto_install": False,

1
account_financial_report/readme/CONTRIBUTORS.rst

@ -22,6 +22,7 @@
* Sergio Teruel
* Ernesto Tejeda
* João Marques
* Alexandre D. Díaz
Much of the work in this module was done at a sprint in Sorrento, Italy in
April 2016.

330
account_financial_report/report/templates/aged_partner_balance.xml

@ -248,210 +248,210 @@
<div class="act_as_row lines">
<!--## date-->
<div class="act_as_cell left">
<!-- <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;">-->
<!--## We don't use t-field because it throws an error on click -->
<t t-esc="line['date']" t-options="{'widget': 'date'}" />
<!-- </a>-->
<!-- </span>-->
<span
t-att-res-id="line.move_line_id.id"
res-model="account.move.line"
view-type="form"
>
<!--## We don't use t-field because it throws an error on click -->
<t t-esc="line['date']" t-options="{'widget': 'date'}" />
</span>
</div>
<!--## move-->
<div class="act_as_cell left">
<!-- <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>-->
<span
t-att-res-id="line.move_line_id.move_id.id"
res-model="account.move"
view-type="form"
>
<t t-raw="line['entry']" />
</span>
</div>
<!--## journal-->
<div class="act_as_cell left">
<!-- <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>-->
<span
t-att-res-id="line.move_line_id.move_id.journal_id.id"
res-model="account.journal"
view-type="form"
>
<t t-raw="line['journal']" />
</span>
</div>
<!--## account code-->
<div class="act_as_cell left">
<!-- <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>-->
<span
t-att-res-id="line.move_line_id.account_id.id"
res-model="account.account"
view-type="form"
>
<t t-raw="line['account']" />
</span>
</div>
<!--## partner-->
<div class="act_as_cell left">
<!-- <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>-->
<span
t-att-res-id="line.move_line_id.partner_id.id"
res-model="res.partner"
view-type="form"
>
<t t-raw="line['partner']" />
</span>
</div>
<!--## ref - label-->
<div class="act_as_cell left">
<!-- <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['ref_label']" />
<!-- </a>-->
<!-- </span>-->
<span
t-att-res-id="line.move_line_id.id"
res-model="account.move.line"
view-type="form"
>
<t t-raw="line['ref_label']" />
</span>
</div>
<!--## date_due-->
<div class="act_as_cell left">
<!-- <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;">-->
<!--## We don't use t-field because it throws an error on click -->
<t t-esc="line['due_date']" t-options="{'widget': 'date'}" />
<!-- </a>-->
<!-- </span>-->
<span
t-att-res-id="line.move_line_id.id"
res-model="account.move.line"
view-type="form"
>
<!--## We don't use t-field because it throws an error on click -->
<t
t-esc="line['due_date']"
t-options="{'widget': 'date'}"
/>
</span>
</div>
<!--## amount_residual-->
<div class="act_as_cell amount">
<!-- <span>-->
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
<!-- t-att-data-res-model="'account.move.line'"-->
<!-- class="o_account_financial_reports_web_action_multi"-->
<!-- style="color: black;">-->
<t
t-raw="line['residual']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
<!-- </a>-->
<!-- </span>-->
<span
domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"
res-model="account.move.line"
>
<t
t-raw="line['residual']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</div>
<!--## current-->
<div class="act_as_cell amount">
<!-- <t t-if="line.current != 0">-->
<!-- <span>-->
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
<!-- 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>-->
<t t-if="line.current == 0">
<span
t-field="line.current"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</t>
<t t-else="">
<span
domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"
res-model="account.move.line"
>
<t
t-raw="line['current']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
<!--## age_30_days-->
<div class="act_as_cell amount">
<!-- <t t-if="line.age_30_days != 0">-->
<!-- <span>-->
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
<!-- t-att-data-res-model="'account.move.line'"-->
<!-- class="o_account_financial_reports_web_action_multi"-->
<!-- style="color: black;">-->
<t
t-raw="line['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>-->
<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>
<t t-else="">
<span
domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"
res-model="account.move.line"
>
<t
t-raw="line['30_days']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
<!--## age_60_days-->
<div class="act_as_cell amount">
<!-- <t t-if="line.age_60_days != 0">-->
<!-- <span>-->
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
<!-- t-att-data-res-model="'account.move.line'"-->
<!-- class="o_account_financial_reports_web_action_multi"-->
<!-- style="color: black;">-->
<t
t-raw="line['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>-->
<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>
<t t-else="">
<span
domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"
res-model="account.move.line"
>
<t
t-raw="line['60_days']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
<!--## age_90_days-->
<div class="act_as_cell amount">
<!-- <t t-if="line.age_90_days != 0">-->
<!-- <span>-->
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
<!-- t-att-data-res-model="'account.move.line'"-->
<!-- class="o_account_financial_reports_web_action_multi"-->
<!-- style="color: black;">-->
<t
t-raw="line['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>-->
<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>
<t t-else="">
<span
domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"
res-model="account.move.line"
>
<t
t-raw="line['90_days']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
<!--## age_120_days-->
<div class="act_as_cell amount">
<!-- <t t-if="line.age_120_days != 0">-->
<!-- <span>-->
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
<!-- t-att-data-res-model="'account.move.line'"-->
<!-- class="o_account_financial_reports_web_action_multi"-->
<!-- style="color: black;">-->
<t
t-raw="line['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>-->
<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>
<t t-else="">
<span
domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"
res-model="account.move.line"
>
<t
t-raw="line['120_days']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
<!--## older-->
<div class="act_as_cell amount">
<!-- <t t-if="line.older != 0">-->
<!-- <span>-->
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
<!-- 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>-->
<t t-if="line.older == 0">
<span
t-field="line.older"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</t>
<t t-else="">
<span
domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"
res-model="account.move.line"
>
<t
t-raw="line['older']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
</div>
</t>

453
account_financial_report/report/templates/general_ledger.xml

@ -232,18 +232,11 @@
('date', '&lt;', 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_monetary_multi"
style="color: black;"
>
<t
t-raw="account_or_partner_object['init_bal']['debit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
<span t-att-domain="domain" res-model="account.move.line">
<t
t-raw="account_or_partner_object['init_bal']['debit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
<t t-if="type == 'partner_type'">
@ -254,18 +247,11 @@
('date', '&lt;', 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_monetary_multi"
style="color: black;"
>
<t
t-raw="account_or_partner_object['init_bal']['debit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
<span t-att-domain="domain" res-model="account.move.line">
<t
t-raw="account_or_partner_object['init_bal']['debit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
@ -278,18 +264,11 @@
('date', '&lt;', 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_monetary_multi"
style="color: black;"
>
<t
t-raw="account_or_partner_object['init_bal']['credit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
<span t-att-domain="domain" res-model="account.move.line">
<t
t-raw="account_or_partner_object['init_bal']['credit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
<t t-if="type == 'partner_type'">
@ -300,18 +279,11 @@
('date', '&lt;', 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_monetary_multi"
style="color: black;"
>
<t
t-raw="account_or_partner_object['init_bal']['credit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
<span t-att-domain="domain" res-model="account.move.line">
<t
t-raw="account_or_partner_object['init_bal']['credit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
@ -323,18 +295,11 @@
t-value="[('account_id', '=', account['id']),
('date', '&lt;', date_from)]"
/>
<span>
<a
t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
style="color: black;"
>
<t
t-raw="account_or_partner_object['init_bal']['balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
<span t-att-domain="domain" res-model="account.move.line">
<t
t-raw="account_or_partner_object['init_bal']['balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
<t t-if="type == 'partner_type'">
@ -344,18 +309,11 @@
('partner_id', '=', partner['id']),
('date', '&lt;', date_from)]"
/>
<span>
<a
t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
style="color: black;"
>
<t
t-raw="account_or_partner_object['init_bal']['balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
<span t-att-domain="domain" res-model="account.move.line">
<t
t-raw="account_or_partner_object['init_bal']['balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
@ -375,18 +333,14 @@
t-value="[('account_id', '=', account['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_monetary_multi"
style="color: black;"
>
<t
t-raw="account_or_partner_object['init_bal']['bal_curr']"
t-options="{'widget': 'monetary', 'display_currency': o._get_atr_from_dict(account['id'], accounts_data, 'currency_id')}"
/>
</a>
<span
t-att-domain="domain"
res-model="account.move.line"
>
<t
t-raw="account_or_partner_object['init_bal']['bal_curr']"
t-options="{'widget': 'monetary', 'display_currency': o._get_atr_from_dict(account['id'], accounts_data, 'currency_id')}"
/>
</span>
</t>
<t t-if="type == 'partner_type'">
@ -396,18 +350,14 @@
('partner_id', '=', partner['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_monetary_multi"
style="color: black;"
>
<t
t-raw="account_or_partner_object['init_bal']['bal_curr']"
t-options="{'widget': 'monetary', 'display_currency': o._get_atr_from_dict(account['id'], accounts_data, 'currency_id')}"
/>
</a>
<span
t-att-domain="domain"
res-model="account.move.line"
>
<t
t-raw="account_or_partner_object['init_bal']['bal_curr']"
t-options="{'widget': 'monetary', 'display_currency': o._get_atr_from_dict(account['id'], accounts_data, 'currency_id')}"
/>
</span>
</t>
</div>
@ -426,82 +376,63 @@
<div class="act_as_row lines">
<!--## date-->
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.move.line'" />
<span>
<t t-if="line['id']">
<a
t-att-data-active-id="line['id']"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;"
>
<!--## We don't use t-field because it throws an error on click -->
<t
t-esc="line['date']"
t-options="{'widget': 'date'}"
/>
</a>
</t>
<t t-if="not line['id']">
<a
class="o_account_financial_reports_web_action"
style="color: black;"
>
<!--## We don't use t-field because it throws an error on click -->
<t
t-esc="line['date']"
t-options="{'widget': 'date'}"
/>
</a>
</t>
</span>
<t t-if="line['id']">
<!--## We don't use t-field because it throws an error on click -->
<span
t-att-res-id="line['id']"
res-model="account.move.line"
view-type="form"
>
<t
t-esc="line['date']"
t-options="{'widget': 'date'}"
/>
</span>
</t>
<t t-else="">
<span>
<!--## We don't use t-field because it throws an error on click -->
<t
t-esc="line['date']"
t-options="{'widget': 'date'}"
/>
</span>
</t>
</div>
<!--## move-->
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.move'" />
<t t-if="line['entry_id']">
<span>
<a
t-att-data-active-id="line['entry_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
t-att-res-id="line['entry_id']"
res-model="account.move"
view-type="form"
>
<t t-raw="line['entry']" />
</span>
</t>
</div>
<!--## journal-->
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.journal'" />
<span>
<a
t-att-data-active-id="line['journal_id']"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;"
>
<t
t-raw="o._get_atr_from_dict(line['journal_id'], journals_data, 'code')"
/>
</a>
<span
t-att-res-id="line['journal_id']"
res-model="account.journal"
view-type="form"
>
<t
t-raw="o._get_atr_from_dict(line['journal_id'], journals_data, 'code')"
/>
</span>
</div>
<!--## account code-->
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.account'" />
<span>
<a
t-att-data-active-id="account['id']"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;"
>
<t
t-raw="o._get_atr_from_dict(account['id'], accounts_data, 'code')"
/>
</a>
<span
t-att-res-id="account['id']"
res-model="account.account"
view-type="form"
>
<t
t-raw="o._get_atr_from_dict(account['id'], accounts_data, 'code')"
/>
</span>
</div>
<!--## taxes-->
@ -516,58 +447,45 @@
</div>
<!--## partner-->
<div class="act_as_cell left">
<t t-set="res_model" t-value="'res.partner'" />
<span t-if="line['partner_id']">
<a
t-att-data-active-id="line['partner_id']"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;"
<t t-if="line['partner_id']">
<span
t-att-res-id="line['partner_id']"
res-model="res.partner"
view-type="form"
>
<t t-raw="line['partner_name']" />
</a>
</span>
</span>
</t>
</div>
<!--## ref - label-->
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.move.line'" />
<t t-if="line['id']">
<span>
<a
t-att-data-active-id="line['id']"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;"
>
<t t-raw="line['ref_label']" />
</a>
<span
t-att-res-id="line['id']"
res-model="account.move.line"
view-type="form"
>
<t t-raw="line['ref_label']" />
</span>
</t>
<t t-if="not line['id']">
<t t-else="">
<span>
<a
class="o_account_financial_reports_web_action"
style="color: black;"
>
<t t-raw="line['ref_label']" />
</a>
<t t-raw="line['ref_label']" />
</span>
</t>
</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['analytic_account_id']">
<a
t-att-data-active-id="line['analytic_account_id']"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;"
<t t-if="line['analytic_account_id']">
<span
t-att-res-id="line['analytic_account_id']"
res-model="account.analytic.account"
view-type="form"
>
<t t-raw="line['analytic_account']" />
</a>
</span>
</span>
</t>
</div>
</t>
<t t-if="show_analytic_tags">
@ -584,111 +502,82 @@
</t>
<!--## matching_number-->
<div class="act_as_cell">
<t t-set="res_model" t-value="'account.full.reconcile'" />
<span t-if="line['rec_id']">
<a
t-att-data-active-id="line['rec_id']"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;"
<t t-if="line['rec_id']">
<span
t-att-res-id="line['rec_id']"
res-model="account.full.reconcile"
view-type="form"
>
<t t-raw="line['rec_name']" />
</a>
</span>
</span>
</t>
</div>
<!--## debit-->
<div class="act_as_cell amount">
<t t-set="res_model" t-value="'account.move.line'" />
<t t-if="line['id']">
<span>
<a
t-att-data-active-id="line['id']"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action_monetary"
style="color: black;"
>
<t
t-raw="line['debit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
<span
t-att-res-id="line['id']"
res-model="account.move.line"
view-type="form"
>
<t
t-raw="line['debit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
<t t-if="not line['id']">
<t t-else="">
<span>
<a
class="o_account_financial_reports_web_action_monetary"
style="color: black;"
>
<t
t-raw="line['debit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
<t
t-raw="line['debit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
<!--## credit-->
<div class="act_as_cell amount">
<t t-set="res_model" t-value="'account.move.line'" />
<t t-if="line['id']">
<span>
<a
t-att-data-active-id="line['id']"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action_monetary"
style="color: black;"
>
<t
t-raw="line['credit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
<span
t-att-res-id="line['id']"
res-model="account.move.line"
view-type="form"
>
<t
t-raw="line['credit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
<t t-if="not line['id']">
<t t-else="">
<span>
<a
class="o_account_financial_reports_web_action_monetary"
style="color: black;"
>
<t
t-raw="line['credit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
<t
t-raw="line['credit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
<!--## balance cumulated-->
<div class="act_as_cell amount">
<t t-set="res_model" t-value="'account.move.line'" />
<t t-if="line['id']">
<span>
<a
t-att-data-active-id="line['id']"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action_monetary"
style="color: black;"
>
<t
t-raw="line['balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
<span
t-att-res-id="line['id']"
res-model="account.move.line"
view-type="form"
>
<t
t-raw="line['balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
<t t-if="not line['id']">
<t t-else="">
<span>
<a
class="o_account_financial_reports_web_action_monetary"
style="color: black;"
>
<t
t-raw="line['balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
<t
t-raw="line['balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
@ -700,16 +589,12 @@
</div>
<!--## amount_currency-->
<div class="act_as_cell amount" style="width: 5.19%;">
<t t-set="res_model" t-value="'account.move.line'" />
<span>
<a
t-att-data-active-id="line['id']"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;"
>
<t t-raw="line['bal_curr']" />
</a>
<span
t-att-res-id="line['id']"
res-model="account.move.line"
view-type="form"
>
<t t-raw="line['bal_curr']" />
</span>
</div>
</t>
@ -799,7 +684,7 @@
/>
<span>
<a
t-att-data-domain="domain"
t-att-data-t-att-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
style="color: black;"
@ -820,7 +705,7 @@
/>
<span>
<a
t-att-data-domain="domain"
t-att-data-t-att-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
style="color: black;"

16
account_financial_report/report/templates/journal_ledger.xml

@ -195,19 +195,17 @@
</template>
<template id="account_financial_report.report_journal_move_line">
<div class="act_as_cell left" name="entry">
<t t-set="res_model" t-value="'account.move'" />
<span t-if="display_move_info">
<a
t-att-data-active-id="move_line['move_id']"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;"
<t t-if="display_move_info">
<span
t-att-res-id="move_line['move_id']"
res-model="account.move"
view-type="form"
>
<t
t-esc="o._get_atr_from_dict(move_line['move_id'], move_ids_data, 'entry')"
/>
</a>
</span>
</span>
</t>
</div>
<div class="act_as_cell left" name="date">
<span

2
account_financial_report/report/templates/layouts.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="account_financial_report.internal_layout">
<div class="article">
<div class="article o_account_financial_reports_page">
<link
href="/account_financial_report/static/src/css/report.css"
rel="stylesheet"

16
account_financial_report/report/templates/open_items.xml

@ -178,16 +178,12 @@
</div>
<!--## move-->
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.move'" />
<span>
<a
t-att-data-active-id="line['move_id']"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;"
>
<t t-esc="line['move_name']" />
</a>
<span
t-att-res-id="line['move_id']"
res-model="account.move"
view-type="form"
>
<t t-esc="line['move_name']" />
</span>
</div>
<!--## journal-->

529
account_financial_report/report/templates/trial_balance.xml

@ -111,18 +111,14 @@
style="margin-top: 10px;"
/>
<div class="act_as_caption account_title" style="width: 100%;">
<t t-set="res_model" t-value="'account.account'" />
<span>
<a
t-att-data-active-id="account_id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
t-att-style="style"
>
<t t-raw="accounts_data[account_id]['code']" />
-
<t t-raw="accounts_data[account_id]['name']" />
</a>
<span
t-att-res-id="account_id"
res-model="account.account"
view-type="form"
>
<t
t-raw="accounts_data[account_id]['code']"
/> - <t t-raw="accounts_data[account_id]['name']" />
</span>
</div>
<div class="act_as_table data_table" style="width: 100%;">
@ -240,59 +236,44 @@
<!--## Code-->
<t t-if="balance['type'] == 'account_type'">
<div class="act_as_cell left">
<!-- <t t-if="accounts_data[account_id]['code']">-->
<t t-set="res_model" t-value="'account.account'" />
<span>
<a
t-att-data-active-id="balance['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-esc="balance['code']" />
</a>
<span
t-att-res-id="balance['id']"
res-model="account.account"
view-type="form"
>
<t t-att-style="style" t-esc="balance['code']" />
</span>
</div>
<!-- ## Account/Partner-->
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.account'" />
<span>
<a
t-att-data-active-id="balance['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-esc="balance['name']" />
</a>
<span
t-att-res-id="balance['id']"
res-model="account.account"
view-type="form"
>
<t t-att-style="style" t-esc="balance['name']" />
</span>
</div>
</t>
<t t-if="balance['type'] == 'group_type'">
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.group'" />
<span>
<a
t-att-data-active-id="balance['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="balance['code']" />
</a>
<span
t-att-res-id="balance['id']"
res-model="account.group"
view-type="form"
>
<t t-att-style="style" t-raw="balance['code']" />
</span>
</div>
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.group'" />
<span>
<a
t-att-data-active-id="balance['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-esc="balance['name']" />
</a>
<span
t-att-res-id="balance['id']"
res-model="account.group"
view-type="form"
>
<t t-att-style="style" t-esc="balance['name']" />
</span>
</div>
</t>
@ -300,18 +281,15 @@
<t t-if="show_partner_details">
<div class="act_as_cell left">
<t t-set="res_model" t-value="'res.partner'" />
<span>
<a
t-att-data-active-id="partner_id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
<span
t-att-res-id="partner_id"
res-model="res.partner"
view-type="form"
>
<t
t-att-style="style"
>
<t
t-att-style="style"
t-esc="partners_data[partner_id]['name']"
/>
</a>
t-esc="partners_data[partner_id]['name']"
/>
</span>
</div>
</t>
@ -324,38 +302,26 @@
t-value="[('account_id', '=', balance['id']),
('date', '&lt;', date_from)]"
/>
<span>
<a
t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
>
<t
t-att-style="style"
t-esc="balance['initial_balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
t-esc="balance['initial_balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
<t t-if="balance['type'] == 'group_type'">
<!-- <t t-set="domain"-->
<!-- t-value="[('account_id', 'in', line.compute_account_ids.ids),-->
<!-- ('date', '&lt;', date_from.strftime('%Y-%m-%d'))]"/>-->
<span>
<a
t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
<t
t-set="domain"
t-value="[('account_id', 'in', line.compute_account_ids.ids),
('date', '&lt;', date_from.strftime('%Y-%m-%d'))]"
/>
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
>
<t
t-att-style="style"
t-raw="balance['initial_balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
t-raw="balance['initial_balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</t>
@ -366,19 +332,12 @@
('partner_id', '=', int(partner_id)),
('date', '&lt;', date_from)]"
/>
<span>
<a
t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
>
<t
t-att-style="style"
t-raw="total_amount[account_id][partner_id]['initial_balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
t-raw="total_amount[account_id][partner_id]['initial_balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
@ -393,40 +352,28 @@
('date', '&lt;=', 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_monetary_multi"
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
>
<t
t-att-style="style"
t-esc="balance['debit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
t-esc="balance['debit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
<t t-if="balance['type'] == 'group_type'">
<!-- <t t-set="domain"-->
<!-- t-value="[('account_id', 'in', line.compute_account_ids.ids),-->
<!-- ('date', '&gt;=', line.report_id.date_from.strftime('%Y-%m-%d')),-->
<!-- ('date', '&lt;=', line.report_id.date_to.strftime('%Y-%m-%d')),-->
<!-- ('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_monetary_multi"
<t
t-set="domain"
t-value="[('account_id', 'in', line.compute_account_ids.ids),
('date', '&gt;=', line.report_id.date_from.strftime('%Y-%m-%d')),
('date', '&lt;=', line.report_id.date_to.strftime('%Y-%m-%d')),
('debit', '&lt;&gt;', 0)]"
/>
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
>
<t
t-att-style="style"
t-raw="balance['debit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
t-raw="balance['debit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</t>
@ -439,19 +386,12 @@
('date', '&lt;=', 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_monetary_multi"
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
>
<t
t-att-style="style"
t-raw="total_amount[account_id][partner_id]['debit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
t-raw="total_amount[account_id][partner_id]['debit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
@ -466,40 +406,28 @@
('date', '&lt;=', 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_monetary_multi"
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
>
<t
t-att-style="style"
t-esc="balance['credit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
t-esc="balance['credit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
<t t-if="balance['type'] == 'group_type'">
<!-- <t t-set="domain"-->
<!-- t-value="[('account_id', 'in', line.compute_account_ids.ids),-->
<!-- ('date', '&gt;=', line.report_id.date_from.strftime('%Y-%m-%d')),-->
<!-- ('date', '&lt;=', line.report_id.date_to.strftime('%Y-%m-%d')),-->
<!-- ('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_monetary_multi"
<t
t-set="domain"
t-value="[('account_id', 'in', line.compute_account_ids.ids),
('date', '&gt;=', line.report_id.date_from.strftime('%Y-%m-%d')),
('date', '&lt;=', line.report_id.date_to.strftime('%Y-%m-%d')),
('credit', '&lt;&gt;', 0)]"
/>
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
>
<t
t-att-style="style"
t-raw="balance['credit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
t-raw="balance['credit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</t>
@ -512,19 +440,12 @@
('date', '&lt;=', 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_monetary_multi"
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
>
<t
t-att-style="style"
t-raw="total_amount[account_id][partner_id]['credit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
t-raw="total_amount[account_id][partner_id]['credit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
@ -532,44 +453,34 @@
<div class="act_as_cell amount">
<t t-if="not show_partner_details">
<t t-if="balance['type'] == 'account_type'">
<!-- <t t-set="domain"-->
<!-- t-value="[('account_id', '=', balance['id']),-->
<!-- ('date', '&gt;=', date_from),-->
<!-- ('date', '&lt;=', date_to),-->
<!-- ('balance', '&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_monetary_multi"
<t
t-set="domain"
t-value="[('account_id', '=', balance['id']),
('date', '&gt;=', date_from),
('date', '&lt;=', date_to),
('balance', '&lt;&gt;', 0)]"
/>
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
>
<t
t-att-style="style"
t-esc="balance['balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
t-esc="balance['balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
<t t-if="balance['type'] == 'group_type'">
<!-- <t t-set="domain"-->
<!-- t-value="[('account_id', 'in', line.compute_account_ids.ids),-->
<!-- ('date', '&gt;=', line.report_id.date_from.strftime('%Y-%m-%d')),-->
<!-- ('date', '&lt;=', line.report_id.date_to.strftime('%Y-%m-%d'))]"/>-->
<span>
<a
t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_multi"
<t
t-set="domain"
t-value="[('account_id', 'in', line.compute_account_ids.ids),
('date', '&gt;=', line.report_id.date_from.strftime('%Y-%m-%d')),
('date', '&lt;=', line.report_id.date_to.strftime('%Y-%m-%d'))]"
/>
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
>
<t
t-att-style="style"
t-raw="balance['balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
t-raw="balance['balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</t>
@ -582,19 +493,12 @@
('date', '&lt;=', date_to),
('balance', '&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_monetary_multi"
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
>
<t
t-att-style="style"
t-raw="total_amount[account_id][partner_id]['balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
t-raw="total_amount[account_id][partner_id]['balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
@ -607,19 +511,12 @@
t-value="[('account_id', '=', balance['id']),
('date', '&lt;=', date_to)]"
/>
<span>
<a
t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
>
<t
t-att-style="style"
t-esc="balance['ending_balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
t-esc="balance['ending_balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
<t t-if="balance['type'] == 'group_type'">
@ -627,19 +524,12 @@
t-set="domain"
t-value="[('account_id', 'in', balance['account_ids'])]"
/>
<span>
<a
t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
>
<t
t-att-style="style"
t-raw="balance['ending_balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
t-raw="balance['ending_balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</t>
@ -650,19 +540,12 @@
('partner_id', '=', int(partner_id)),
('date', '&lt;=', date_to)]"
/>
<span>
<a
t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
>
<t
t-att-style="style"
t-esc="total_amount[account_id][partner_id]['ending_balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</a>
t-esc="total_amount[account_id][partner_id]['ending_balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</t>
</div>
@ -676,26 +559,24 @@
</div>
<!--## Initial balance cur.-->
<div class="act_as_cell amount">
<!-- <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_monetary_multi"
<t
t-set="domain"
t-value="[('account_id', '=', line.account_id.id)]"
/>
<span
t-att-domain="domain"
res-model="account.move.line"
>
<t
t-att-style="style"
>
<t
t-att-style="style"
t-esc="balance['initial_currency_balance']"
/>
</a>
t-esc="balance['initial_currency_balance']"
/>
</span>
<!-- <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"-->
<!-- <a t-att-data-t-att-domain="domain"-->
<!-- t-att-data-res-model="'account.move.line'"-->
<!-- class="o_account_financial_reports_web_action_monetary_multi"-->
<!-- t-att-style="style">-->
@ -716,21 +597,19 @@
/>
</div>
<div class="act_as_cell amount">
<!-- <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_monetary_multi"
<t
t-set="domain"
t-value="[('account_id', '=', line.report_account_id.account_id.id),
('partner_id', '=', line.partner_id.id)]"
/>
<span
t-att-domain="domain"
res-model="account.move.line"
>
<t
t-att-style="style"
>
<t
t-att-style="style"
t-raw="total_amount[account_id][partner_id]['initial_currency_balance']"
/>
</a>
t-raw="total_amount[account_id][partner_id]['initial_currency_balance']"
/>
</span>
</div>
</t>
@ -741,26 +620,24 @@
<t t-if="balance['type'] == 'account_type'">
<t t-if="balance['currency_id']">
<div class="act_as_cell amount">
<!-- <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_monetary_multi"
<t
t-set="domain"
t-value="[('account_id', '=', line.account_id.id)]"
/>
<span
t-att-domain="domain"
res-model="account.move.line"
>
<t
t-att-style="style"
>
<t
t-att-style="style"
t-raw="balance['ending_currency_balance']"
/>
</a>
t-raw="balance['ending_currency_balance']"
/>
</span>
<!-- <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"-->
<!-- <a t-att-data-t-att-domain="domain"-->
<!-- t-att-data-res-model="'account.move.line'"-->
<!-- class="o_account_financial_reports_web_action_monetary_multi"-->
<!-- t-att-style="style">-->
@ -775,21 +652,19 @@
<t t-if="total_amount[account_id]['currency_id']">
<div class="act_as_cell amount">
<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_monetary_multi"
<t
t-set="domain"
t-value="[('account_id', '=', line.report_account_id.account_id.id),
('partner_id', '=', line.partner_id.id)]"
/>
<span
t-att-domain="domain"
res-model="account.move.line"
>
<t
t-att-style="style"
>
<t
t-att-style="style"
t-raw="total_amount[account_id][partner_id]['ending_currency_balance']"
/>
</a>
t-raw="total_amount[account_id][partner_id]['ending_currency_balance']"
/>
</span>
</t>
</div>
@ -843,7 +718,7 @@
<!-- t-value="[('account_id', '=', account.account_id.id),-->
<!-- ('date', '&lt;', o.date_from.strftime('%Y-%m-%d'))]"/>-->
<!-- <span>-->
<!-- <a t-att-data-domain="domain"-->
<!-- <a t-att-data-t-att-domain="domain"-->
<!-- t-att-data-res-model="'account.move.line'"-->
<!-- class="o_account_financial_reports_web_action_monetary_multi"-->
<!-- t-att-style="style">-->
@ -858,7 +733,7 @@
<!-- ('date', '&lt;=', account.report_id.date_to.strftime('%Y-%m-%d')),-->
<!-- ('debit', '&lt;&gt;', 0)]"/>-->
<!-- <span>-->
<!-- <a t-att-data-domain="domain"-->
<!-- <a t-att-data-t-att-domain="domain"-->
<!-- t-att-data-res-model="'account.move.line'"-->
<!-- class="o_account_financial_reports_web_action_monetary_multi"-->
<!-- t-att-style="style">-->
@ -873,7 +748,7 @@
<!-- ('date', '&lt;=', account.report_id.date_to.strftime('%Y-%m-%d')),-->
<!-- ('credit', '&lt;&gt;', 0)]"/>-->
<!-- <span>-->
<!-- <a t-att-data-domain="domain"-->
<!-- <a t-att-data-t-att-domain="domain"-->
<!-- t-att-data-res-model="'account.move.line'"-->
<!-- class="o_account_financial_reports_web_action_monetary_multi"-->
<!-- t-att-style="style">-->
@ -888,7 +763,7 @@
<!-- ('date', '&lt;=', account.report_id.date_to.strftime('%Y-%m-%d')),-->
<!-- ('period_balance', '&lt;&gt;', 0)]"/>-->
<!-- <span>-->
<!-- <a t-att-data-domain="domain"-->
<!-- <a t-att-data-t-att-domain="domain"-->
<!-- t-att-data-res-model="'account.move.line'"-->
<!-- class="o_account_financial_reports_web_action_monetary_multi"-->
<!-- t-att-style="style">-->
@ -900,7 +775,7 @@
<!-- <t t-set="domain"-->
<!-- t-value="[('account_id', '=', account.account_id.id)]"/>-->
<!-- <span>-->
<!-- <a t-att-data-domain="domain"-->
<!-- <a t-att-data-t-att-domain="domain"-->
<!-- t-att-data-res-model="'account.move.line'"-->
<!-- class="o_account_financial_reports_web_action_monetary_multi"-->
<!-- t-att-style="style" >-->
@ -921,7 +796,7 @@
<!-- t-value="[('account_id', '=', account.account_id.id),-->
<!-- ('date', '&lt;', date_from.strftime('%Y-%m-%d'))]"/>-->
<!-- <span>-->
<!-- <a t-att-data-domain="domain"-->
<!-- <a t-att-data-t-att-domain="domain"-->
<!-- t-att-data-res-model="'account.move.line'"-->
<!-- class="o_account_financial_reports_web_action_monetary_multi"-->
<!-- t-att-style="style">-->
@ -932,7 +807,7 @@
<!-- <t t-set="domain"-->
<!-- t-value="[('account_id', '=', account.account_id.id)]"/>-->
<!-- <span>-->
<!-- <a t-att-data-domain="domain"-->
<!-- <a t-att-data-t-att-domain="domain"-->
<!-- t-att-data-res-model="'account.move.line'"-->
<!-- class="o_account_financial_reports_web_action_monetary_multi"-->
<!-- t-att-style="style" >-->

157
account_financial_report/report/templates/vat_report.xml

@ -50,64 +50,56 @@
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_or_group['code']" />
<!-- </a>-->
<!-- </span>-->
<span
t-att-res-id="res_id"
t-att-res-model="res_model"
view-type="form"
>
<t t-att-style="style" t-raw="tag_or_group['code']" />
</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_or_group['name']" />
<!-- </a>-->
<!-- </span>-->
<span
t-att-res-id="res_id"
t-att-res-model="res_model"
view-type="form"
>
<t t-att-style="style" t-raw="tag_or_group['name']" />
</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_or_group['net']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
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)]"
/>
<!-- </a>-->
<!-- </span>-->
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
t-raw="tag_or_group['net']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</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_or_group['tax']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
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)]"
/>
<!-- </a>-->
<!-- </span>-->
<span t-att-domain="domain" res-model="account.move.line">
<t
t-att-style="style"
t-raw="tag_or_group['tax']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</div>
</div>
<t t-if="tax_detail">
@ -118,52 +110,51 @@
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>-->
<span
t-att-res-id="tax.tax_id.id"
t-att-res-model="res_model"
view-type="form"
>
<t t-att-style="style" t-raw="tax['name']" />
</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}"
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)]"
/>
<!-- </a>-->
<!-- </span>-->
<span
t-att-domain="domain"
res-model="account.move.line"
>
<t
t-att-style="style"
t-raw="tax['net']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</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}"
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)]"
/>
<!-- </a>-->
<!-- </span>-->
<span
t-att-domain="domain"
res-model="account.move.line"
>
<t
t-att-style="style"
t-raw="tax['tax']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</span>
</div>
</div>
</t>

1
account_financial_report/static/description/index.html

@ -484,6 +484,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Sergio Teruel</li>
<li>Ernesto Tejeda</li>
<li>João Marques</li>
<li>Alexandre D. Díaz</li>
</ul>
</li>
</ul>

6
account_financial_report/static/src/css/report.css

@ -81,9 +81,9 @@
.act_as_cell.right {
text-align: right;
}
.list_table .act_as_cell {
/* border-right:1px solid lightGrey; uncomment to active column lines */
}
/*.list_table .act_as_cell {*/
/* border-right:1px solid lightGrey; uncomment to active column lines */
/*}*/
.list_table .act_as_cell.first_column {
padding-left: 0px;
/* border-left:1px solid lightGrey; uncomment to active column lines */

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

@ -1,109 +0,0 @@
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 ReportWidget = require("account_financial_report.account_financial_report_widget");
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 () {
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 () {
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);
});
},
canBeRemoved: function () {
return $.when();
},
});
core.action_registry.add("account_financial_report_backend", report_backend);
return report_backend;
});

88
account_financial_report/static/src/js/account_financial_report_widgets.js

@ -1,88 +0,0 @@
odoo.define("account_financial_report.account_financial_report_widget", function (
require
) {
"use strict";
var Widget = require("web.Widget");
var accountFinancialReportWidget = Widget.extend({
events: {
"click .o_account_financial_reports_web_action": "boundLink",
"click .o_account_financial_reports_web_action_multi": "boundLinkmulti",
"click .o_account_financial_reports_web_action_monetary":
"boundLinkMonetary",
"click .o_account_financial_reports_web_action_monetary_multi":
"boundLinkMonetarymulti",
},
init: function () {
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",
});
},
boundLinkmulti: function (e) {
var res_model = $(e.target).data("res-model");
var domain = $(e.target).data("domain");
if (!res_model) {
res_model = $(e.target.parentElement).data("res-model");
}
if (!domain) {
domain = $(e.target.parentElement).data("domain");
}
return this.do_action({
type: "ir.actions.act_window",
name: this._toTitleCase(res_model.split(".").join(" ")),
res_model: res_model,
domain: domain,
views: [
[false, "list"],
[false, "form"],
],
target: "current",
});
},
boundLinkMonetary: function (e) {
var res_model = $(e.target.parentElement).data("res-model");
var res_id = $(e.target.parentElement).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",
});
},
boundLinkMonetarymulti: function (e) {
var res_model = $(e.target.parentElement).data("res-model");
var domain = $(e.target.parentElement).data("domain");
return this.do_action({
type: "ir.actions.act_window",
res_model: res_model,
domain: domain,
views: [
[false, "list"],
[false, "form"],
],
target: "current",
});
},
_toTitleCase: function (str) {
return str.replace(/\w\S*/g, function (txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
});
},
});
return accountFinancialReportWidget;
});

35
account_financial_report/static/src/js/action_manager_report.js

@ -0,0 +1,35 @@
odoo.define("account_financial_report.ReportActionManager", function (require) {
"use strict";
const ActionManager = require("web.ActionManager");
require("web.ReportActionManager");
ActionManager.include({
/**
* @override
*/
_executeReportClientAction: function (action, options) {
const MODULE_NAME = "account_financial_report";
// When 'report_action' is called from the backend, Odoo hardcodes the action tag.
// We have to make a hack to use our own report controller.
if (action.report_name.startsWith(`${MODULE_NAME}.`)) {
const urls = this._makeReportUrls(action);
const clientActionOptions = _.extend({}, options, {
context: action.context,
data: action.data,
display_name: action.display_name,
name: action.name,
report_file: action.report_file,
report_name: action.report_name,
report_url: urls.html,
});
return this.doAction(
"account_financial_report.client_action",
clientActionOptions
);
}
return this._super.apply(this, arguments);
},
});
});

58
account_financial_report/static/src/js/client_action.js

@ -0,0 +1,58 @@
odoo.define("account_financial_report.client_action", function (require) {
"use strict";
var ReportAction = require("report.client_action");
var core = require("web.core");
var QWeb = core.qweb;
const AFRReportAction = ReportAction.extend({
start: function () {
return this._super.apply(this, arguments).then(() => {
this.$buttons = $(
QWeb.render(
"account_financial_report.client_action.ControlButtons",
{}
)
);
this.$buttons.on("click", ".o_report_print", this.on_click_print);
this.$buttons.on("click", ".o_report_export", this.on_click_export);
this.controlPanelProps.cp_content = {
$buttons: this.$buttons,
};
this._controlPanelWrapper.update(this.controlPanelProps);
});
},
on_click_export: function () {
const action = {
type: "ir.actions.report",
report_type: "xlsx",
report_name: this._get_xlsx_name(this.report_name),
report_file: this._get_xlsx_name(this.report_file),
data: this.data,
context: this.context,
display_name: this.title,
};
return this.do_action(action);
},
/**
* @param {String} str
* @returns {String}
*/
_get_xlsx_name: function (str) {
if (!_.isString(str)) {
return str;
}
const parts = str.split(".");
return `a_f_r.report_${parts[parts.length - 1]}_xlsx`;
},
});
core.action_registry.add("account_financial_report.client_action", AFRReportAction);
return AFRReportAction;
});

58
account_financial_report/static/src/js/report.js

@ -0,0 +1,58 @@
odoo.define("account_financial_report.report", function (require) {
"use strict";
require("web.dom_ready");
const utils = require("report.utils");
if (window.self === window.top) {
return;
}
const web_base_url = $("html").attr("web-base-url");
const trusted_host = utils.get_host_from_url(web_base_url);
const trusted_protocol = utils.get_protocol_from_url(web_base_url);
const trusted_origin = utils.build_origin(trusted_protocol, trusted_host);
/**
* Convert a model name to a capitalized title style
* Example: account.mode.line --> Account Move Line
*
* @param {String} str
* @returns {String}
*/
function toTitleCase(str) {
return str
.replaceAll(".", " ")
.replace(
/\w\S*/g,
(txt) => `${txt.charAt(0).toUpperCase()}${txt.substr(1).toLowerCase()}`
);
}
// Allow sending commands to the webclient
// `do_action` command with domain
$("[res-model][domain]")
.wrap("<a/>")
.attr("href", "#")
.on("click", function (ev) {
ev.preventDefault();
const res_model = $(this).attr("res-model");
const action = {
type: "ir.actions.act_window",
res_model: res_model,
domain: $(this).attr("domain"),
name: toTitleCase(res_model),
views: [
[false, "list"],
[false, "form"],
],
};
window.parent.postMessage(
{
message: "report:do_action",
action: action,
},
trusted_origin
);
});
});

17
account_financial_report/static/src/xml/report.xml

@ -0,0 +1,17 @@
<template>
<!-- Buttons of the Control Panel -->
<t t-name="account_financial_report.client_action.ControlButtons">
<div class="o_report_buttons">
<button
type="button"
class="btn btn-primary o_report_print"
title="Print"
>Print</button>
<button
type="button"
class="btn btn-secondary o_report_export"
title="Export"
>Export</button>
</div>
</t>
</template>

80
account_financial_report/view/report_template.xml

@ -2,82 +2,30 @@
<odoo>
<template
id="account_financial_report_assets_backend"
name="account_financial_report assets"
name="account_financial_report assets_backend"
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"
src="/account_financial_report/static/src/js/action_manager_report.js"
/>
<script
type="text/javascript"
src="/account_financial_report/static/src/js/account_financial_report_widgets.js"
src="/account_financial_report/static/src/js/client_action.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
id="account_financial_report_assets_common"
name="account_financial_report report_assets"
inherit_id="web.report_assets_common"
>
<xpath expr="." position="inside">
<script
type="text/javascript"
src="/account_financial_report/static/src/js/report.js"
/>
</xpath>
</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="{'model': 'report.account_financial_report.general_ledger'}"
/>
</record>
<record id="action_report_journal_ledger" model="ir.actions.client">
<field name="name">Journal</field>
<field name="tag">account_financial_report_backend</field>
<field
name="context"
eval="{'model': 'report.account_financial_report.journal_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="{'model': 'report.account_financial_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="{'model': 'report.account_financial_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="{'model': 'report.account_financial_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="{'model': 'report.account_financial_report.vat_report'}"
/>
</record>
</odoo>
Loading…
Cancel
Save