[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).
{
"name": "Account Financial Reports",
"version": "16.0.1.4.0",
"version": "17.0.1.0.0",
"category": "Reporting",
"summary": "OCA Financial Reports",
"author": "Camptocamp SA,"

View File

@@ -209,7 +209,6 @@ class GeneralLedgerReport(models.AbstractModel):
else:
prt_id = gl["partner_id"][0]
prt_name = gl["partner_id"][1]
prt_name = prt_name._value
acc_id = gl["account_id"][0]
data[acc_id][prt_id] = self._prepare_gen_ld_data_item(gl)
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"]:
tax_id = gl["tax_line_id"][0]
tax_name = gl["tax_line_id"][1]
tax_name = tax_name._value
else:
tax_id = 0
tax_name = "Missing Tax"

View File

@@ -211,6 +211,6 @@ class OpenItemsXslx(models.AbstractModel):
name = my_object["code"] + " - " + my_object["name"]
my_object["residual"] = total_amount[account_id]["residual"]
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
)

View File

@@ -257,7 +257,7 @@ class TrialBalanceXslx(models.AbstractModel):
line_object.currency_id = line_object.report_account_id.currency_id
elif type_object == "account":
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):
"""Specific function to write account footer for Trial Balance"""

View File

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

View File

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

View File

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

View File

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