[MIG] account_financial_report: Migration to 18.0

This commit is contained in:
chaule97
2024-11-18 16:48:37 +07:00
parent c46e83a4a4
commit 01f22b8256
43 changed files with 292 additions and 220 deletions

View File

@@ -75,7 +75,7 @@ Example of configuration inferior limit:
It means the first interval is from 0 to 15, the second from 16 to 30,
and the third is 61+.
Go on 'Invoicing' -> 'Reports' -> 'OCA accounting reports' -> 'Aged
Go on 'Invoicing' -> 'Reporting' -> 'OCA accounting reports' -> 'Aged
Partner Balance'
When wizard is open, you need to select your interval configuration and
@@ -167,7 +167,7 @@ Contributors
- Pedro M. Baeza
- Sergio Teruel
- Ernesto Tejeda
- Jo??o Marques
- João Marques
- Alexandre D. D??az
- V??ctor Mart??nez
- Carolina Fernandez
@@ -180,10 +180,17 @@ Contributors
- Lois Rilo <lois.rilo@forgeflow.com>
- Saran Lim. <saranl@ecosoft.co.th>
- Omar Casti??eira <omar@comunitea.com>
- Chau Le <chaulb@trobz.com>
Much of the work in this module was done at a sprint in Sorrento, Italy
in April 2016.
Other credits
-------------
The migration of this module from 17.0 to 18.0 was financially supported
by Camptocamp.
Maintainers
-----------

View File

@@ -2,11 +2,11 @@
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
# Copyright 2021 Tecnativa - Jo??o Marques
# Copyright 2021 Tecnativa - João Marques
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Account Financial Reports",
"version": "17.0.1.5.0",
"version": "18.0.1.0.0",
"category": "Reporting",
"summary": "OCA Financial Reports",
"author": "Camptocamp,"
@@ -47,6 +47,7 @@
"assets": {
"web.assets_backend": [
"account_financial_report/static/src/js/*",
"account_financial_report/static/src/scss/*",
"account_financial_report/static/src/xml/**/*",
],
},

View File

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

View File

@@ -1,7 +1,7 @@
# Copyright 2023 Ernesto García
# Copyright 2023 Carolina Fernandez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo import api, fields, models
from odoo.exceptions import ValidationError
@@ -21,7 +21,7 @@ class AccountAgeReportConfiguration(models.Model):
def _check_line_ids(self):
for rec in self:
if not rec.line_ids:
raise ValidationError(_("Must complete Configuration Lines"))
raise ValidationError(self.env._("Must complete Configuration Lines"))
class AccountAgeReportConfigurationLine(models.Model):
@@ -36,12 +36,14 @@ class AccountAgeReportConfigurationLine(models.Model):
def _check_inferior_limit(self):
for rec in self:
if rec.inferior_limit <= 0:
raise ValidationError(_("Inferior Limit must be greather than zero"))
raise ValidationError(
self.env._("Inferior Limit must be greather than zero")
)
_sql_constraints = [
(
"unique_name_config_combination",
"UNIQUE(name,account_age_report_config_id)",
_("Name must be unique per report configuration"),
"Name must be unique per report configuration",
)
]

View File

@@ -1,4 +1,4 @@
# ?? 2018 Forest and Biomass Romania SA
# © 2018 Forest and Biomass Romania SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models

View File

@@ -16,7 +16,7 @@ Example of configuration inferior limit:
It means the first interval is from 0 to 15, the second from 16 to 30, and the third is 61+.
Go on 'Invoicing' -> 'Reports' -> 'OCA accounting reports' -> 'Aged Partner Balance'
Go on 'Invoicing' -> 'Reporting' -> 'OCA accounting reports' -> 'Aged Partner Balance'
When wizard is open, you need to select your interval configuration and print report.

View File

@@ -20,7 +20,7 @@
- Pedro M. Baeza
- Sergio Teruel
- Ernesto Tejeda
- Jo??o Marques
- João Marques
- Alexandre D. D??az
- V??ctor Mart??nez
- Carolina Fernandez
@@ -30,6 +30,7 @@
- Lois Rilo \<<lois.rilo@forgeflow.com>\>
- Saran Lim. \<<saranl@ecosoft.co.th>\>
- Omar Casti??eira \<<omar@comunitea.com>\>
- Chau Le \<<chaulb@trobz.com>\>
Much of the work in this module was done at a sprint in Sorrento, Italy
in April 2016.

View File

@@ -0,0 +1 @@
The migration of this module from 17.0 to 18.0 was financially supported by Camptocamp.

View File

@@ -1,6 +1,6 @@
# ?? 2015 Yannick Vaucher (Camptocamp)
# ?? 2016 Damien Crier (Camptocamp)
# ?? 2016 Julien Coux (Camptocamp)
# © 2015 Yannick Vaucher (Camptocamp)
# © 2016 Damien Crier (Camptocamp)
# © 2016 Julien Coux (Camptocamp)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
from . import abstract_report

View File

@@ -143,7 +143,9 @@ class AgedPartnerBalanceReport(models.AbstractModel):
return accounts_data
def _get_journals_data(self, journals_ids):
journals = self.env["account.journal"].browse(journals_ids)
journals = self.env["account.journal"].search_fetch(
[("id", "in", journals_ids)], ["code"]
)
journals_data = {}
for journal in journals:
journals_data.update({journal.id: {"id": journal.id, "code": journal.code}})

View File

@@ -1,6 +1,6 @@
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# Copyright 2021 Tecnativa - Jo??o Marques
# Copyright 2021 Tecnativa - João Marques
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models
@@ -571,7 +571,7 @@ class AbstractReportXslx(models.AbstractModel):
"""Return amount header format for each currency."""
format_amt = report_data["formats"]["format_header_amount"]
if line_object.currency_id:
field_name = "format_header_amount_%s" % line_object.currency_id.name
field_name = f"format_header_amount_{line_object.currency_id.name}"
if hasattr(self, field_name):
format_amt = getattr(self, field_name)
else:
@@ -589,7 +589,7 @@ class AbstractReportXslx(models.AbstractModel):
"""Return amount header format for each currency."""
format_amt = report_data["formats"]["format_header_amount"]
if line_object["currency_id"]:
field_name = "format_header_amount_%s" % line_object["currency_name"]
field_name = f"format_header_amount_{line_object['currency_name']}"
if hasattr(self, field_name):
format_amt = getattr(self, field_name)
else:

View File

@@ -1,4 +1,4 @@
# ?? 2016 Julien Coux (Camptocamp)
# © 2016 Julien Coux (Camptocamp)
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
@@ -72,25 +72,21 @@ class AgedPartnerBalanceReport(models.AbstractModel):
else:
ag_pb_data[acc_id]["older"] += residual
ag_pb_data[acc_id][prt_id]["older"] += residual
if due_date:
days_difference = abs((today - due_date).days)
for index, line in enumerate(interval_lines):
lower_limit = (
0 if not index else interval_lines[index - 1].inferior_limit
)
next_line = (
interval_lines[index] if index < len(interval_lines) else None
)
interval_range = self._get_values_for_range_intervals(
lower_limit, next_line.inferior_limit
)
if (
days_difference in interval_range
or days_difference == line.inferior_limit
):
ag_pb_data[acc_id][line] += residual
ag_pb_data[acc_id][prt_id][line] += residual
break
days_difference = abs((today - due_date).days)
for index, line in enumerate(interval_lines):
lower_limit = 0 if not index else interval_lines[index - 1].inferior_limit
next_line = interval_lines[index] if index < len(interval_lines) else None
interval_range = self._get_values_for_range_intervals(
lower_limit, next_line.inferior_limit
)
if (
days_difference in interval_range
or days_difference == line.inferior_limit
):
ag_pb_data[acc_id][line] += residual
ag_pb_data[acc_id][prt_id][line] += residual
break
return ag_pb_data
def _get_values_for_range_intervals(self, num1, num2):

View File

@@ -1,9 +1,9 @@
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# Copyright 2021 Tecnativa - Jo??o Marques
# Copyright 2021 Tecnativa - João Marques
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import _, models
from odoo import models
class AgedPartnerBalanceXslx(models.AbstractModel):
@@ -13,7 +13,7 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
def _get_report_name(self, report, data=False):
company_id = data.get("company_id", False)
report_name = _("Aged Partner Balance")
report_name = self.env._("Aged Partner Balance")
if company_id:
company = self.env["res.company"].browse(company_id)
suffix = f" - {company.name} - {company.currency_id.name}"
@@ -22,16 +22,16 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
def _get_report_columns_without_move_line_details(self, report, column_index):
report_columns = {
0: {"header": _("Partner"), "field": "name", "width": 70},
0: {"header": self.env._("Partner"), "field": "name", "width": 70},
1: {
"header": _("Residual"),
"header": self.env._("Residual"),
"field": "residual",
"field_footer_total": "residual",
"type": "amount",
"width": 14,
},
2: {
"header": _("Current"),
"header": self.env._("Current"),
"field": "current",
"field_footer_total": "current",
"field_footer_percent": "percent_current",
@@ -43,7 +43,7 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
report_columns.update(
{
3: {
"header": _("Age ≤ 30 d."),
"header": self.env._("Age ≤ 30 d."),
"field": "30_days",
"field_footer_total": "30_days",
"field_footer_percent": "percent_30_days",
@@ -51,7 +51,7 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
"width": 14,
},
4: {
"header": _("Age ≤ 60 d."),
"header": self.env._("Age ≤ 60 d."),
"field": "60_days",
"field_footer_total": "60_days",
"field_footer_percent": "percent_60_days",
@@ -59,7 +59,7 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
"width": 14,
},
5: {
"header": _("Age ≤ 90 d."),
"header": self.env._("Age ≤ 90 d."),
"field": "90_days",
"field_footer_total": "90_days",
"field_footer_percent": "percent_90_days",
@@ -67,7 +67,7 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
"width": 14,
},
6: {
"header": _("Age ≤ 120 d."),
"header": self.env._("Age ≤ 120 d."),
"field": "120_days",
"field_footer_total": "120_days",
"field_footer_percent": "percent_120_days",
@@ -75,7 +75,7 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
"width": 14,
},
7: {
"header": _("Older"),
"header": self.env._("Older"),
"field": "older",
"field_footer_total": "older",
"field_footer_percent": "percent_older",
@@ -98,15 +98,15 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
def _get_report_columns_with_move_line_details(self, report, column_index):
report_columns = {
0: {"header": _("Date"), "field": "date", "width": 11},
1: {"header": _("Entry"), "field": "entry", "width": 18},
2: {"header": _("Journal"), "field": "journal", "width": 8},
3: {"header": _("Account"), "field": "account", "width": 9},
4: {"header": _("Partner"), "field": "partner", "width": 25},
5: {"header": _("Ref - Label"), "field": "ref_label", "width": 40},
6: {"header": _("Due date"), "field": "due_date", "width": 11},
0: {"header": self.env._("Date"), "field": "date", "width": 11},
1: {"header": self.env._("Entry"), "field": "entry", "width": 18},
2: {"header": self.env._("Journal"), "field": "journal", "width": 8},
3: {"header": self.env._("Account"), "field": "account", "width": 9},
4: {"header": self.env._("Partner"), "field": "partner", "width": 25},
5: {"header": self.env._("Ref - Label"), "field": "ref_label", "width": 40},
6: {"header": self.env._("Due date"), "field": "due_date", "width": 11},
7: {
"header": _("Residual"),
"header": self.env._("Residual"),
"field": "residual",
"field_footer_total": "residual",
"field_final_balance": "residual",
@@ -114,7 +114,7 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
"width": 14,
},
8: {
"header": _("Current"),
"header": self.env._("Current"),
"field": "current",
"field_footer_total": "current",
"field_footer_percent": "percent_current",
@@ -127,7 +127,7 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
report_columns.update(
{
9: {
"header": _("Age ≤ 30 d."),
"header": self.env._("Age ≤ 30 d."),
"field": "30_days",
"field_footer_total": "30_days",
"field_footer_percent": "percent_30_days",
@@ -136,7 +136,7 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
"width": 14,
},
10: {
"header": _("Age ≤ 60 d."),
"header": self.env._("Age ≤ 60 d."),
"field": "60_days",
"field_footer_total": "60_days",
"field_footer_percent": "percent_60_days",
@@ -145,7 +145,7 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
"width": 14,
},
11: {
"header": _("Age ≤ 90 d."),
"header": self.env._("Age ≤ 90 d."),
"field": "90_days",
"field_footer_total": "90_days",
"field_footer_percent": "percent_90_days",
@@ -154,7 +154,7 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
"width": 14,
},
12: {
"header": _("Age ≤ 120 d."),
"header": self.env._("Age ≤ 120 d."),
"field": "120_days",
"field_footer_total": "120_days",
"field_footer_percent": "percent_120_days",
@@ -163,7 +163,7 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
"width": 14,
},
13: {
"header": _("Older"),
"header": self.env._("Older"),
"field": "older",
"field_footer_total": "older",
"field_footer_percent": "percent_older",
@@ -194,12 +194,12 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
def _get_report_filters(self, report):
return [
[_("Date at filter"), report.date_at.strftime("%d/%m/%Y")],
[self.env._("Date at filter"), report.date_at.strftime("%d/%m/%Y")],
[
_("Target moves filter"),
_("All posted entries")
self.env._("Target moves filter"),
self.env._("All posted entries")
if report.target_move == "posted"
else _("All entries"),
else self.env._("All entries"),
],
]
@@ -321,7 +321,7 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
for Aged Partner Balance
"""
name = None
label = _("Partner cumul aged balance")
label = self.env._("Partner cumul aged balance")
return super().write_ending_balance_from_dict(
my_object, name, label, report_data
)

View File

@@ -1,4 +1,4 @@
# ?? 2016 Julien Coux (Camptocamp)
# © 2016 Julien Coux (Camptocamp)
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
# Copyright 2022 Tecnativa - V??ctor Mart??nez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
@@ -17,14 +17,18 @@ class GeneralLedgerReport(models.AbstractModel):
_inherit = "report.account_financial_report.abstract_report"
def _get_analytic_data(self, account_ids):
analytic_accounts = self.env["account.analytic.account"].browse(account_ids)
analytic_accounts = self.env["account.analytic.account"].search_fetch(
[("id", "in", account_ids)], ["name"]
)
analytic_data = {}
for account in analytic_accounts:
analytic_data.update({account.id: {"name": account.name}})
return analytic_data
def _get_taxes_data(self, taxes_ids):
taxes = self.env["account.tax"].browse(taxes_ids)
taxes = self.env["account.tax"].search_fetch(
[("id", "in", taxes_ids)], ["amount", "amount_type", "display_name"]
)
taxes_data = {}
for tax in taxes:
taxes_data.update(
@@ -61,7 +65,7 @@ class GeneralLedgerReport(models.AbstractModel):
def _get_acc_prt_accounts_ids(self, company_id, grouped_by):
accounts_domain = [
("company_id", "=", company_id),
("company_ids", "in", [company_id]),
] + self._get_account_type_domain(grouped_by)
acc_prt_accounts = self.env["account.account"].search(accounts_domain)
return acc_prt_accounts.ids
@@ -70,7 +74,7 @@ class GeneralLedgerReport(models.AbstractModel):
self, account_ids, company_id, date_from, base_domain, grouped_by, acc_prt=False
):
accounts_domain = [
("company_id", "=", company_id),
("company_ids", "in", [company_id]),
("include_initial_balance", "=", True),
]
if account_ids:
@@ -88,7 +92,7 @@ class GeneralLedgerReport(models.AbstractModel):
self, account_ids, company_id, date_from, fy_start_date, base_domain
):
accounts_domain = [
("company_id", "=", company_id),
("company_ids", "in", [company_id]),
("include_initial_balance", "=", False),
]
if account_ids:
@@ -118,7 +122,7 @@ class GeneralLedgerReport(models.AbstractModel):
self, account_ids, company_id, fy_start_date, base_domain
):
accounts_domain = [
("company_id", "=", company_id),
("company_ids", "in", [company_id]),
("include_initial_balance", "=", False),
]
if account_ids:
@@ -155,7 +159,13 @@ class GeneralLedgerReport(models.AbstractModel):
return pl_initial_balance
def _get_gl_initial_acc(
self, account_ids, company_id, date_from, fy_start_date, base_domain, grouped_by
self,
account_ids,
company_id,
date_from,
fy_start_date,
base_domain,
grouped_by,
):
initial_domain_bs = self._get_initial_balances_bs_ml_domain(
account_ids, company_id, date_from, base_domain, grouped_by
@@ -182,7 +192,7 @@ class GeneralLedgerReport(models.AbstractModel):
data[acc_id]["id"] = acc_id
if grouped_by:
data[acc_id][grouped_by] = False
method = "_prepare_gen_ld_data_group_%s" % grouped_by
method = f"_prepare_gen_ld_data_group_{grouped_by}"
if not hasattr(self, method):
return data
return getattr(self, method)(data, domain, grouped_by)
@@ -265,7 +275,7 @@ class GeneralLedgerReport(models.AbstractModel):
unaffected_earnings_account = False
base_domain = []
if company_id:
base_domain += [("company_id", "=", company_id)]
base_domain += [("company_id", "in", [company_id])]
if partner_ids:
base_domain += [("partner_id", "in", partner_ids)]
if only_posted_moves:
@@ -423,7 +433,9 @@ class GeneralLedgerReport(models.AbstractModel):
res.append({"id": item_id, "name": item_name})
elif move_line["tax_ids"]:
for tax_id in move_line["tax_ids"]:
tax_item = self.env["account.tax"].browse(tax_id)
tax_item = self.env["account.tax"].search_fetch(
[("id", "=", tax_id)], ["name"]
)
res.append({"id": tax_item.id, "name": tax_item.name})
else:
res.append({"id": 0, "name": "Missing Tax"})

View File

@@ -1,7 +1,7 @@
# Author: Damien Crier
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# Copyright 2021 Tecnativa - Jo??o Marques
# Copyright 2021 Tecnativa - João Marques
# Copyright 2022 Tecnativa - V??ctor Mart??nez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
@@ -203,7 +203,7 @@ class GeneralLedgerXslx(models.AbstractModel):
)
else:
analytic_distribution += (
"%s " % analytic_data[int(account_id)]["name"]
f"{analytic_data[int(account_id)]['name']} "
)
line.update(
{
@@ -313,7 +313,7 @@ class GeneralLedgerXslx(models.AbstractModel):
)
else:
analytic_distribution += (
"%s " % analytic_data[int(account_id)]["name"]
f"{analytic_data[int(account_id)]['name']} "
)
line.update(
{

View File

@@ -264,7 +264,9 @@ class JournalLedgerReport(models.AbstractModel):
journal_id = ml_data["journal_id"]
if journal_id not in journals_taxes_data.keys():
journals_taxes_data[journal_id] = {}
taxes = self.env["account.tax"].browse(tax_ids)
taxes = self.env["account.tax"].search_fetch(
[("id", "in", tax_ids)], ["name", "description"]
)
for tax in taxes:
if tax.id not in journals_taxes_data[journal_id]:
journals_taxes_data[journal_id][tax.id] = {

View File

@@ -1,7 +1,7 @@
# Author: Damien Crier
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# Copyright 2021 Tecnativa - Jo??o Marques
# Copyright 2021 Tecnativa - João Marques
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import _, models

View File

@@ -1,4 +1,4 @@
# ?? 2016 Julien Coux (Camptocamp)
# © 2016 Julien Coux (Camptocamp)
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

View File

@@ -1,6 +1,6 @@
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# Copyright 2021 Tecnativa - Jo??o Marques
# Copyright 2021 Tecnativa - João Marques
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import _, models

View File

@@ -1,10 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="account_financial_report.html_container">
<link
href="/account_financial_report/static/src/css/report_html.css"
rel="stylesheet"
/>
<t t-call-assets="web.assets_backend" />
<t t-set="body_classname" t-value="'container'" />
<t t-call="web.report_layout">
<t t-out="0" />
@@ -12,17 +9,14 @@
</template>
<template id="account_financial_report.internal_layout">
<div class="article o_account_financial_reports_page">
<link
href="/account_financial_report/static/src/css/report.css"
rel="stylesheet"
/>
<t t-call-assets="web.assets_backend" />
<t t-out="0" />
</div>
<div class="footer">
<div class="row">
<div class="col-6 custom_footer">
<span
t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d %H:%M')"
t-out="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d %H:%M')"
/>
</div>
<div class="col-6 text-right custom_footer">

View File

@@ -1,5 +1,5 @@
# ?? 2016 Julien Coux (Camptocamp)
# ?? 2018 Forest and Biomass Romania SA
# © 2016 Julien Coux (Camptocamp)
# © 2018 Forest and Biomass Romania SA
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
@@ -24,7 +24,7 @@ class TrialBalanceReport(models.AbstractModel):
show_partner_details,
):
accounts_domain = [
("company_id", "=", company_id),
("company_ids", "in", [company_id]),
("include_initial_balance", "=", True),
]
if account_ids:
@@ -64,7 +64,7 @@ class TrialBalanceReport(models.AbstractModel):
fy_start_date,
):
accounts_domain = [
("company_id", "=", company_id),
("company_ids", "in", [company_id]),
("include_initial_balance", "=", False),
]
if account_ids:
@@ -142,7 +142,7 @@ class TrialBalanceReport(models.AbstractModel):
show_partner_details,
):
accounts_domain = [
("company_id", "=", company_id),
("company_ids", "in", [company_id]),
("include_initial_balance", "=", False),
]
if account_ids:
@@ -419,7 +419,7 @@ class TrialBalanceReport(models.AbstractModel):
fy_start_date,
grouped_by,
):
accounts_domain = [("company_id", "=", company_id)]
accounts_domain = [("company_ids", "in", [company_id])]
if account_ids:
accounts_domain += [("id", "in", account_ids)]
# If explicit list of accounts is provided,
@@ -697,7 +697,6 @@ class TrialBalanceReport(models.AbstractModel):
"code": group.code_prefix_start,
"name": group.name,
"parent_id": group.parent_id.id,
"parent_path": group.parent_path,
"complete_code": group.complete_code,
"account_ids": group.compute_account_ids.ids,
"type": "group_type",
@@ -751,7 +750,6 @@ class TrialBalanceReport(models.AbstractModel):
"code": group.code_prefix_start,
"name": group.name,
"parent_id": group.parent_id.id,
"parent_path": group.parent_path,
"type": "group_type",
"complete_code": group.complete_code,
"account_ids": group.compute_account_ids.ids,
@@ -804,7 +802,6 @@ class TrialBalanceReport(models.AbstractModel):
"code": group.code_prefix_start,
"name": group.name,
"parent_id": group.parent_id.id,
"parent_path": group.parent_path,
"type": "group_type",
"complete_code": group.complete_code,
"account_ids": group.compute_account_ids.ids,

View File

@@ -1,6 +1,6 @@
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# Copyright 2021 Tecnativa - Jo??o Marques
# Copyright 2021 Tecnativa - João Marques
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

View File

@@ -97,7 +97,9 @@ class VATReport(models.AbstractModel):
return vat_data, tax_data
def _get_tax_group_data(self, tax_group_ids):
tax_groups = self.env["account.tax.group"].browse(tax_group_ids)
tax_groups = self.env["account.tax.group"].search_fetch(
[("id", "in", tax_group_ids)], ["name", "sequence"]
)
tax_group_data = {}
for tax_group in tax_groups:
tax_group_data.update(
@@ -135,7 +137,7 @@ class VATReport(models.AbstractModel):
vat_report[tax_group_id]["tax"] += tax_move_line["tax"]
vat_report[tax_group_id][tax_id]["net"] += tax_move_line["net"]
vat_report[tax_group_id][tax_id]["tax"] += tax_move_line["tax"]
tax_group_data = self._get_tax_group_data(vat_report.keys())
tax_group_data = self._get_tax_group_data(list(vat_report.keys()))
vat_report_list = []
for tax_group_id in vat_report.keys():
vat_report[tax_group_id]["name"] = tax_group_data[tax_group_id]["name"]
@@ -151,7 +153,9 @@ class VATReport(models.AbstractModel):
return vat_report_list
def _get_tags_data(self, tags_ids):
tags = self.env["account.account.tag"].browse(tags_ids)
tags = self.env["account.account.tag"].search_fetch(
[("id", "in", tags_ids)], ["name"]
)
tags_data = {}
for tag in tags:
tags_data.update({tag.id: {"code": "", "name": tag.name}})
@@ -183,7 +187,7 @@ class VATReport(models.AbstractModel):
vat_report[tag_id][tax_id]["tax"] += tax_move_line["tax"]
vat_report[tag_id]["net"] += tax_move_line["net"]
vat_report[tag_id]["tax"] += tax_move_line["tax"]
tags_data = self._get_tags_data(vat_report.keys())
tags_data = self._get_tags_data(list(vat_report.keys()))
vat_report_list = []
for tag_id in vat_report.keys():
vat_report[tag_id]["name"] = tags_data[tag_id]["name"]

View File

@@ -1,5 +1,5 @@
# Copyright 2018 Forest and Biomass Romania
# Copyright 2021 Tecnativa - Jo??o Marques
# Copyright 2021 Tecnativa - João Marques
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import _, models

View File

@@ -404,7 +404,8 @@ Partner Balance. For further information, check CONFIGURE.rst</p>
<li><a class="reference internal" href="#credits" id="toc-entry-8">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-9">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-10">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-11">Maintainers</a></li>
<li><a class="reference internal" href="#other-credits" id="toc-entry-11">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-12">Maintainers</a></li>
</ul>
</li>
</ul>
@@ -421,7 +422,7 @@ the interval</p>
<p>-&gt; 15 -&gt; 30 -&gt; 60</p>
<p>It means the first interval is from 0 to 15, the second from 16 to 30,
and the third is 61+.</p>
<p>Go on Invoicing -&gt; Reports -&gt; OCA accounting reports -&gt; Aged
<p>Go on Invoicing -&gt; Reporting -&gt; OCA accounting reports -&gt; Aged
Partner Balance</p>
<p>When wizard is open, you need to select your interval configuration and
print report.</p>
@@ -511,7 +512,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<li>Pedro M. Baeza</li>
<li>Sergio Teruel</li>
<li>Ernesto Tejeda</li>
<li>Jo??o Marques</li>
<li>João Marques</li>
<li>Alexandre D. D??az</li>
<li>V??ctor Mart??nez</li>
<li>Carolina Fernandez</li>
@@ -525,12 +526,18 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<li>Lois Rilo &lt;<a class="reference external" href="mailto:lois.rilo&#64;forgeflow.com">lois.rilo&#64;forgeflow.com</a>&gt;</li>
<li>Saran Lim. &lt;<a class="reference external" href="mailto:saranl&#64;ecosoft.co.th">saranl&#64;ecosoft.co.th</a>&gt;</li>
<li>Omar Casti??eira &lt;<a class="reference external" href="mailto:omar&#64;comunitea.com">omar&#64;comunitea.com</a>&gt;</li>
<li>Chau Le &lt;<a class="reference external" href="mailto:chaulb&#64;trobz.com">chaulb&#64;trobz.com</a>&gt;</li>
</ul>
<p>Much of the work in this module was done at a sprint in Sorrento, Italy
in April 2016.</p>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-11">Other credits</a></h2>
<p>The migration of this module from 17.0 to 18.0 was financially supported
by Camptocamp.</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-11">Maintainers</a></h2>
<h2><a class="toc-backref" href="#toc-entry-12">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />

View File

@@ -1,7 +0,0 @@
/* Styles of html report */
.account_title span {
font-size: 1rem !important;
}
.act_as_cell {
font-size: 0.9rem !important;
}

View File

@@ -1,5 +1,3 @@
/** @odoo-module */
import {useComponent, useEffect} from "@odoo/owl";
function toTitleCase(str) {
@@ -12,6 +10,7 @@ function toTitleCase(str) {
}
function enrich(component, targetElement, selector, isIFrame = false) {
// eslint-disable-next-line no-undef
let doc = window.document;
let contentDocument = targetElement;

View File

@@ -1,4 +1,3 @@
// /** @odoo-module **/
import {ReportAction} from "@web/webclient/actions/reports/report_action";
import {patch} from "@web/core/utils/patch";
import {useEnrichWithActionLinks} from "./report.esm";

View File

@@ -1,104 +1,137 @@
a {
color: #00337b;
}
.act_as_table {
display: table !important;
background-color: white;
}
.act_as_row {
display: table-row !important;
page-break-inside: avoid;
}
.act_as_cell {
display: table-cell !important;
page-break-inside: avoid;
}
.act_as_thead {
display: table-header-group !important;
}
.act_as_tbody {
display: table-row-group !important;
}
.list_table,
.data_table,
.totals_table {
width: 100% !important;
}
.act_as_row.labels {
background-color: #f0f0f0 !important;
}
.list_table,
.data_table,
.totals_table,
.list_table .act_as_row {
border-left: 0px;
border-right: 0px;
border-left: 0;
border-right: 0;
text-align: center;
font-size: 10px;
padding-right: 3px;
padding-left: 3px;
padding-top: 2px;
padding-bottom: 2px;
padding: 2px 3px;
border-collapse: collapse;
}
.totals_table {
font-weight: bold;
text-align: center;
}
.list_table .act_as_row.labels,
.list_table .act_as_row.initial_balance,
.list_table .act_as_row.lines {
border-color: grey !important;
border-bottom: 1px solid lightGrey !important;
.list_table {
.act_as_row {
&.labels,
&.initial_balance,
&.lines {
border-color: grey !important;
border-bottom: 1px solid lightGrey !important;
}
}
}
.data_table .act_as_cell {
border: 1px solid lightGrey;
text-align: center;
.data_table {
.act_as_cell {
border: 1px solid lightGrey;
text-align: center;
word-wrap: break-word;
}
.act_as_row.labels {
font-weight: bold;
}
}
.data_table .act_as_cell,
.list_table .act_as_cell,
.totals_table .act_as_cell {
word-wrap: break-word;
.totals_table {
.act_as_cell {
word-wrap: break-word;
}
.act_as_row.labels {
font-weight: bold;
}
}
.data_table .act_as_row.labels,
.totals_table .act_as_row.labels {
font-weight: bold;
.list_table .act_as_cell {
&.first_column {
padding-left: 0;
/* border-left:1px solid lightGrey; uncomment to active column lines */
}
/* border-right:1px solid lightGrey; uncomment to active column lines */
}
.initial_balance .act_as_cell {
font-style: italic;
}
.account_title {
font-size: 11px;
font-weight: bold;
&.labels {
background-color: #f0f0f0 !important;
}
}
.account_title.labels {
background-color: #f0f0f0 !important;
}
.act_as_cell.amount {
word-wrap: normal;
text-align: right;
}
.act_as_cell.left {
text-align: left;
}
.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.first_column {
padding-left: 0px;
/* border-left:1px solid lightGrey; uncomment to active column lines */
.act_as_cell {
&.amount {
word-wrap: normal;
text-align: right;
}
&.left {
text-align: left;
}
&.right {
text-align: right;
}
}
.overflow_ellipsis {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.custom_footer {
font-size: 7px !important;
}
.page_break {
page-break-inside: avoid;
}
@@ -110,7 +143,6 @@ a {
.o_account_financial_reports_page {
padding-top: 10px;
width: 90%;
margin-right: auto;
margin-left: auto;
margin: 0 auto;
font-family: Helvetica, Arial;
}

View File

@@ -0,0 +1,10 @@
// Styles of HTML report
.account_title {
span {
font-size: 1rem !important;
}
}
.act_as_cell {
font-size: 0.9rem !important;
}

View File

@@ -1,4 +1,4 @@
# ?? 2016 Julien Coux (Camptocamp)
# © 2016 Julien Coux (Camptocamp)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
from . import test_aged_partner_balance

View File

@@ -15,8 +15,8 @@ from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@tagged("post_install", "-at_install")
class TestGeneralLedgerReport(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,
@@ -42,7 +42,7 @@ class TestGeneralLedgerReport(AccountTestInvoicingCommon):
"=",
"equity_unaffected",
),
("company_id", "=", cls.env.user.company_id.id),
("company_ids", "in", [cls.env.user.company_id.id]),
],
limit=1,
)

View File

@@ -7,8 +7,7 @@ from datetime import datetime
from dateutil.relativedelta import relativedelta
from odoo.fields import Date
from odoo.tests import tagged
from odoo.tests.common import Form
from odoo.tests import Form, tagged
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@@ -16,8 +15,8 @@ from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@tagged("post_install", "-at_install")
class TestJournalReport(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,

View File

@@ -10,8 +10,8 @@ from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@tagged("post_install", "-at_install")
class TestOpenItems(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,

View File

@@ -3,6 +3,8 @@
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import re
from odoo.tests import tagged
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@@ -11,8 +13,8 @@ from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@tagged("post_install", "-at_install")
class TestTrialBalanceReport(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,
@@ -69,11 +71,11 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
"account_type": "income_other",
},
)
cls.account301 = cls._create_account_account(
cls.account201 = cls._create_account_account(
cls,
{
"code": "301",
"name": "Account 301",
"code": "201",
"name": "Account 201",
"group_id": cls.group2.id,
"account_type": "income_other",
},
@@ -167,7 +169,7 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
"debit": receivable_credit,
"credit": receivable_debit,
"partner_id": partner.id,
"account_id": self.account301.id,
"account_id": self.account201.id,
},
),
],
@@ -686,8 +688,13 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
self.assertEqual(total_debit, total_credit)
def test_05_all_accounts_loaded(self):
# Tests if all accounts are loaded when the account_code_ fields changed
all_accounts = self.env["account.account"].search([], order="code")
# Tests if all accounts which code is number are loaded
# when the account_code_ fields changed
all_accounts = (
self.env["account.account"]
.search([], order="code")
.filtered(lambda acc: re.fullmatch(r"[0-9]+(\.[0-9]+)?", acc.code))
)
company = self.env.user.company_id
trial_balance = self.env["trial.balance.report.wizard"].create(
{

View File

@@ -6,8 +6,7 @@ import time
from datetime import date
from odoo import fields
from odoo.tests import tagged
from odoo.tests.common import Form
from odoo.tests import Form, tagged
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@@ -47,8 +46,8 @@ class TestVATReport(AccountTestInvoicingCommon):
return rslt
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,
@@ -68,7 +67,7 @@ class TestVATReport(AccountTestInvoicingCommon):
cls.expense_account = cls.company_data["default_account_expense"]
cls.tax_account = cls.env["account.account"].search(
[
("company_id", "=", cls.company.id),
("company_ids", "in", [cls.company.id]),
(
"account_type",
"=",

View File

@@ -14,28 +14,28 @@
<field name="company_id" />
</group>
<field name="line_ids">
<tree editable="bottom">
<list editable="bottom">
<field name="name" />
<field name="inferior_limit" />
</tree>
</list>
</field>
</sheet>
</form>
</field>
</record>
<record id="aged_partner_report_configuration_tree" model="ir.ui.view">
<field name="name">Age partner report configuration tree</field>
<field name="name">Age partner report configuration list</field>
<field name="model">account.age.report.configuration</field>
<field name="arch" type="xml">
<tree>
<list>
<field name="name" />
<field name="company_id" />
</tree>
</list>
</field>
</record>
<record id="action_aged_partner_report_configuration" model="ir.actions.act_window">
<field name="name">Age Partner Report Configuration</field>
<field name="res_model">account.age.report.configuration</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
</record>
</odoo>

View File

@@ -63,7 +63,7 @@ class AgedPartnerBalanceWizard(models.TransientModel):
)
if self.company_id:
self.account_ids = self.account_ids.filtered(
lambda a: a.company_id == self.company_id
lambda a: self.company_id in a.company_ids
)
return {
"domain": {
@@ -84,13 +84,15 @@ class AgedPartnerBalanceWizard(models.TransientModel):
self.onchange_type_accounts_only()
else:
self.account_ids = self.account_ids.filtered(
lambda a: a.company_id == self.company_id
lambda a: self.company_id in a.company_ids
)
res = {"domain": {"account_ids": [], "partner_ids": []}}
if not self.company_id:
return res
else:
res["domain"]["account_ids"] += [("company_id", "=", self.company_id.id)]
res["domain"]["account_ids"] += [
("company_ids", "in", [self.company_id.id])
]
res["domain"]["partner_ids"] += self._get_partner_ids_domain()
return res
@@ -101,7 +103,7 @@ class AgedPartnerBalanceWizard(models.TransientModel):
@api.onchange("receivable_accounts_only", "payable_accounts_only")
def onchange_type_accounts_only(self):
"""Handle receivable/payable accounts only change."""
domain = [("company_id", "=", self.company_id.id)]
domain = [("company_ids", "in", [self.company_id.id])]
if self.receivable_accounts_only or self.payable_accounts_only:
if self.receivable_accounts_only and self.payable_accounts_only:
domain += [

View File

@@ -10,7 +10,7 @@
import time
from ast import literal_eval
from odoo import _, api, fields, models
from odoo import api, fields, models
from odoo.exceptions import ValidationError
from odoo.tools import date_utils
@@ -147,7 +147,7 @@ class GeneralLedgerReportWizard(models.TransientModel):
count = self.env["account.account"].search_count(
[
("account_type", "=", "equity_unaffected"),
("company_id", "=", self.company_id.id or self.env.company.id),
("company_ids", "in", [self.company_id.id or self.env.company.id]),
]
)
return count == 1
@@ -226,7 +226,7 @@ class GeneralLedgerReportWizard(models.TransientModel):
and rec.company_id != rec.date_range_id.company_id
):
raise ValidationError(
_(
self.env._(
"The Company in the General Ledger Report Wizard and in "
"Date Range must be the same."
)
@@ -236,7 +236,7 @@ class GeneralLedgerReportWizard(models.TransientModel):
def onchange_type_accounts_only(self):
"""Handle receivable/payable accounts only change."""
if self.receivable_accounts_only or self.payable_accounts_only:
domain = [("company_id", "=", self.company_id.id)]
domain = [("company_ids", "in", [self.company_id.id])]
if self.receivable_accounts_only and self.payable_accounts_only:
domain += [
("account_type", "in", ("asset_receivable", "liability_payable"))
@@ -263,7 +263,7 @@ class GeneralLedgerReportWizard(models.TransientModel):
record.unaffected_earnings_account = self.env["account.account"].search(
[
("account_type", "=", "equity_unaffected"),
("company_id", "=", record.company_id.id),
("company_ids", "in", [record.company_id.id]),
]
)

View File

@@ -1,7 +1,7 @@
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo import api, fields, models
class JournalLedgerReportWizard(models.TransientModel):
@@ -38,15 +38,19 @@ class JournalLedgerReportWizard(models.TransientModel):
@api.model
def _get_move_targets(self):
return [("all", _("All")), ("posted", _("Posted")), ("draft", _("Not Posted"))]
return [
("all", self.env._("All")),
("posted", self.env._("Posted")),
("draft", self.env._("Not Posted")),
]
@api.model
def _get_sort_options(self):
return [("move_name", _("Entry number")), ("date", _("Date"))]
return [("move_name", self.env._("Entry number")), ("date", self.env._("Date"))]
@api.model
def _get_group_options(self):
return [("journal", _("Journal")), ("none", _("No group"))]
return [("journal", self.env._("Journal")), ("none", self.env._("No group"))]
@api.onchange("date_range_id")
def onchange_date_range_id(self):

View File

@@ -120,7 +120,7 @@ class OpenItemsReportWizard(models.TransientModel):
@api.onchange("receivable_accounts_only", "payable_accounts_only")
def onchange_type_accounts_only(self):
"""Handle receivable/payable accounts only change."""
domain = [("company_id", "=", self.company_id.id)]
domain = [("company_ids", "in", [self.company_id.id])]
if self.receivable_accounts_only or self.payable_accounts_only:
if self.receivable_accounts_only and self.payable_accounts_only:
domain += [

View File

@@ -4,7 +4,7 @@
# Copyright 2018 ForgeFlow, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import _, api, fields, models
from odoo import api, fields, models
from odoo.exceptions import UserError, ValidationError
from odoo.tools import date_utils
@@ -93,7 +93,7 @@ class TrialBalanceReportWizard(models.TransientModel):
)
if self.company_id:
self.account_ids = self.account_ids.filtered(
lambda a: a.company_id == self.company_id
lambda a: self.company_id in a.company_ids
)
@api.constrains("show_hierarchy", "show_hierarchy_level")
@@ -101,7 +101,9 @@ class TrialBalanceReportWizard(models.TransientModel):
for rec in self:
if rec.show_hierarchy and rec.show_hierarchy_level <= 0:
raise UserError(
_("The hierarchy level to filter on must be greater than 0.")
self.env._(
"The hierarchy level to filter on must be greater than 0."
)
)
@api.depends("date_from")
@@ -121,7 +123,7 @@ class TrialBalanceReportWizard(models.TransientModel):
count = self.env["account.account"].search_count(
[
("account_type", "=", "equity_unaffected"),
("company_id", "=", self.company_id.id or self.env.company.id),
("company_ids", "in", [self.company_id.id or self.env.company.id]),
]
)
return count == 1
@@ -151,7 +153,7 @@ class TrialBalanceReportWizard(models.TransientModel):
self.onchange_type_accounts_only()
else:
self.account_ids = self.account_ids.filtered(
lambda a: a.company_id == self.company_id
lambda a: self.company_id in a.company_ids
)
res = {
"domain": {
@@ -189,7 +191,7 @@ class TrialBalanceReportWizard(models.TransientModel):
and rec.company_id != rec.date_range_id.company_id
):
raise ValidationError(
_(
self.env._(
"The Company in the Trial Balance Report Wizard and in "
"Date Range must be the same."
)
@@ -199,7 +201,7 @@ class TrialBalanceReportWizard(models.TransientModel):
def onchange_type_accounts_only(self):
"""Handle receivable/payable accounts only change."""
if self.receivable_accounts_only or self.payable_accounts_only:
domain = [("company_id", "=", self.company_id.id)]
domain = [("company_ids", "in", [self.company_id.id])]
if self.receivable_accounts_only and self.payable_accounts_only:
domain += [
("account_type", "in", ("asset_receivable", "liability_payable"))
@@ -227,7 +229,7 @@ class TrialBalanceReportWizard(models.TransientModel):
record.unaffected_earnings_account = self.env["account.account"].search(
[
("account_type", "=", "equity_unaffected"),
("company_id", "=", record.company_id.id),
("company_ids", "in", [record.company_id.id]),
]
)

View File

@@ -1,7 +1,7 @@
# Copyright 2018 Forest and Biomass Romania
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import _, api, fields, models
from odoo import api, fields, models
from odoo.exceptions import ValidationError
@@ -60,7 +60,7 @@ class VATReportWizard(models.TransientModel):
and rec.company_id != rec.date_range_id.company_id
):
raise ValidationError(
_(
self.env._(
"The Company in the Vat Report Wizard and in "
"Date Range must be the same."
)