[MIG] account_financial_report: Migration to 17.0

This commit is contained in:
Henrik Norlin
2024-01-24 19:36:27 +01:00
committed by chaule97
parent 0b128f03ee
commit e6904a2449
8 changed files with 53 additions and 72 deletions

View File

@@ -6,7 +6,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{ {
"name": "Account Financial Reports", "name": "Account Financial Reports",
"version": "16.0.1.4.0", "version": "17.0.1.0.0",
"category": "Reporting", "category": "Reporting",
"summary": "OCA Financial Reports", "summary": "OCA Financial Reports",
"author": "Camptocamp SA," "author": "Camptocamp SA,"

View File

@@ -209,7 +209,6 @@ class GeneralLedgerReport(models.AbstractModel):
else: else:
prt_id = gl["partner_id"][0] prt_id = gl["partner_id"][0]
prt_name = gl["partner_id"][1] prt_name = gl["partner_id"][1]
prt_name = prt_name._value
acc_id = gl["account_id"][0] acc_id = gl["account_id"][0]
data[acc_id][prt_id] = self._prepare_gen_ld_data_item(gl) data[acc_id][prt_id] = self._prepare_gen_ld_data_item(gl)
data[acc_id][prt_id]["id"] = prt_id data[acc_id][prt_id]["id"] = prt_id
@@ -236,7 +235,6 @@ class GeneralLedgerReport(models.AbstractModel):
if "tax_line_id" in gl and gl["tax_line_id"]: if "tax_line_id" in gl and gl["tax_line_id"]:
tax_id = gl["tax_line_id"][0] tax_id = gl["tax_line_id"][0]
tax_name = gl["tax_line_id"][1] tax_name = gl["tax_line_id"][1]
tax_name = tax_name._value
else: else:
tax_id = 0 tax_id = 0
tax_name = "Missing Tax" tax_name = "Missing Tax"

View File

@@ -211,6 +211,6 @@ class OpenItemsXslx(models.AbstractModel):
name = my_object["code"] + " - " + my_object["name"] name = my_object["code"] + " - " + my_object["name"]
my_object["residual"] = total_amount[account_id]["residual"] my_object["residual"] = total_amount[account_id]["residual"]
label = _("Ending balance") label = _("Ending balance")
return super(OpenItemsXslx, self).write_ending_balance_from_dict( return super().write_ending_balance_from_dict(
my_object, name, label, report_data my_object, name, label, report_data
) )

View File

@@ -257,7 +257,7 @@ class TrialBalanceXslx(models.AbstractModel):
line_object.currency_id = line_object.report_account_id.currency_id line_object.currency_id = line_object.report_account_id.currency_id
elif type_object == "account": elif type_object == "account":
line_object.currency_id = line_object.currency_id line_object.currency_id = line_object.currency_id
return super(TrialBalanceXslx, self).write_line(line_object, report_data) return super().write_line(line_object, report_data)
def write_account_footer(self, account, name_value, report_data): def write_account_footer(self, account, name_value, report_data):
"""Specific function to write account footer for Trial Balance""" """Specific function to write account footer for Trial Balance"""

View File

@@ -1,40 +1,40 @@
/** @odoo-module **/ // /** @odoo-module **/
import {ReportAction} from "@web/webclient/actions/reports/report_action"; // import {ReportAction} from "@web/webclient/actions/reports/report_action";
import {patch} from "web.utils"; // import { patch } from "@web/core/utils/patch";
import {useEnrichWithActionLinks} from "./report.esm"; // import {useEnrichWithActionLinks} from "./report.esm";
const MODULE_NAME = "account_financial_report"; // const MODULE_NAME = "account_financial_report";
patch(ReportAction.prototype, "account_financial_report.ReportAction", { // patch(ReportAction.prototype, "account_financial_report.ReportAction", {
setup() { // setup() {
this._super.apply(this, arguments); // this._super.apply(this, arguments);
this.isAccountFinancialReport = this.props.report_name.startsWith( // this.isAccountFinancialReport = this.props.report_name.startsWith(
`${MODULE_NAME}.` // `${MODULE_NAME}.`
); // );
useEnrichWithActionLinks(this.iframe); // useEnrichWithActionLinks(this.iframe);
}, // },
export() { // export() {
this.action.doAction({ // this.action.doAction({
type: "ir.actions.report", // type: "ir.actions.report",
report_type: "xlsx", // report_type: "xlsx",
report_name: this._get_xlsx_name(this.props.report_name), // report_name: this._get_xlsx_name(this.props.report_name),
report_file: this._get_xlsx_name(this.props.report_file), // report_file: this._get_xlsx_name(this.props.report_file),
data: this.props.data || {}, // data: this.props.data || {},
context: this.props.context || {}, // context: this.props.context || {},
display_name: this.title, // display_name: this.title,
}); // });
}, // },
/** // /**
* @param {String} str // * @param {String} str
* @returns {String} // * @returns {String}
*/ // */
_get_xlsx_name(str) { // _get_xlsx_name(str) {
if (!_.isString(str)) { // if (!_.isString(str)) {
return str; // return str;
} // }
const parts = str.split("."); // const parts = str.split(".");
return `a_f_r.report_${parts[parts.length - 1]}_xlsx`; // return `a_f_r.report_${parts[parts.length - 1]}_xlsx`;
}, // },
}); // });

View File

@@ -4,7 +4,6 @@
t-name="info.ReportAction" t-name="info.ReportAction"
t-inherit="web.ReportAction" t-inherit="web.ReportAction"
t-inherit-mode="extension" t-inherit-mode="extension"
owl="1"
> >
<xpath expr="//button" position="after"> <xpath expr="//button" position="after">
<button <button

View File

@@ -13,9 +13,7 @@
groups="base.group_multi_company" groups="base.group_multi_company"
/> />
</group> </group>
<div <div invisible="not_only_one_unaffected_earnings_account == True">
attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}"
>
<group name="filters"> <group name="filters">
<group name="date_range"> <group name="date_range">
<field name="date_range_id" /> <field name="date_range_id" />
@@ -95,9 +93,7 @@
</page> </page>
</notebook> </notebook>
</div> </div>
<div <div invisible="not_only_one_unaffected_earnings_account == False">
attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}"
>
<field <field
name="not_only_one_unaffected_earnings_account" name="not_only_one_unaffected_earnings_account"
invisible="1" invisible="1"
@@ -110,9 +106,7 @@
<group /> <group />
</div> </div>
<footer> <footer>
<div <div invisible="not_only_one_unaffected_earnings_account == True">
attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}"
>
<button <button
name="button_export_html" name="button_export_html"
string="View" string="View"
@@ -135,9 +129,7 @@
or or
<button string="Cancel" class="oe_link" special="cancel" /> <button string="Cancel" class="oe_link" special="cancel" />
</div> </div>
<div <div invisible="not_only_one_unaffected_earnings_account == False">
attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}"
>
<button string="Cancel" class="oe_link" special="cancel" /> <button string="Cancel" class="oe_link" special="cancel" />
</div> </div>
</footer> </footer>

View File

@@ -13,9 +13,7 @@
groups="base.group_multi_company" groups="base.group_multi_company"
/> />
</group> </group>
<div <div invisible="not_only_one_unaffected_earnings_account == True">
attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}"
>
<group name="filters"> <group name="filters">
<group name="date_range"> <group name="date_range">
<field name="date_range_id" /> <field name="date_range_id" />
@@ -29,26 +27,26 @@
<field name="show_partner_details" /> <field name="show_partner_details" />
<field <field
name="show_hierarchy" name="show_hierarchy"
attrs="{'invisible':[('show_partner_details','=',True)]}" invisible="show_partner_details == True"
/> />
<field <field
name="limit_hierarchy_level" name="limit_hierarchy_level"
attrs="{'invisible':['|', ('show_hierarchy','=',False),('show_partner_details','=',True)]}" invisible="show_hierarchy == False or show_partner_details == True"
/> />
<field <field
name="show_hierarchy_level" name="show_hierarchy_level"
attrs="{'invisible':[('limit_hierarchy_level','=', False)]}" invisible="limit_hierarchy_level == False"
/> />
<field <field
name="hide_parent_hierarchy_level" name="hide_parent_hierarchy_level"
attrs="{'invisible':[('limit_hierarchy_level','=', False)]}" invisible="limit_hierarchy_level == False"
/> />
<field name="foreign_currency" /> <field name="foreign_currency" />
</group> </group>
</group> </group>
<group <group
name="partner_filter" name="partner_filter"
attrs="{'invisible':[('show_partner_details','!=',True)]}" invisible="show_partner_details == True"
col="1" col="1"
> >
<label for="partner_ids" /> <label for="partner_ids" />
@@ -66,7 +64,7 @@
nolabel="1" nolabel="1"
options="{'no_create': True}" options="{'no_create': True}"
/> />
<group attrs="{'invisible':[('show_partner_details','!=',True)]}" /> <group invisible="show_partner_details == True" />
<div /> <div />
<group name="account_filter" col="4"> <group name="account_filter" col="4">
<label for="account_ids" colspan="4" /> <label for="account_ids" colspan="4" />
@@ -97,9 +95,7 @@
/> />
</group> </group>
</div> </div>
<div <div invisible="not_only_one_unaffected_earnings_account == False">
attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}"
>
<field <field
name="not_only_one_unaffected_earnings_account" name="not_only_one_unaffected_earnings_account"
invisible="1" invisible="1"
@@ -112,9 +108,7 @@
<group /> <group />
</div> </div>
<footer> <footer>
<div <div invisible="not_only_one_unaffected_earnings_account == True">
attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}"
>
<button <button
name="button_export_html" name="button_export_html"
string="View" string="View"
@@ -137,9 +131,7 @@
or or
<button string="Cancel" class="oe_link" special="cancel" /> <button string="Cancel" class="oe_link" special="cancel" />
</div> </div>
<div <div invisible="not_only_one_unaffected_earnings_account == False">
attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}"
>
<button string="Cancel" class="oe_link" special="cancel" /> <button string="Cancel" class="oe_link" special="cancel" />
</div> </div>
</footer> </footer>