[MIG] account_financial_report: Migration to 16.0

This commit is contained in:
David Ramia
2022-12-20 14:25:50 +01:00
committed by chaule97
parent 0e20eeb133
commit 4de4c3d2b1
23 changed files with 289 additions and 318 deletions

View File

@@ -1,11 +1,29 @@
# Copyright 2019 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
from odoo import api, models
from odoo import api, fields, models
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
analytic_account_ids = fields.Many2many(
"account.analytic.account", compute="_compute_analytic_account_ids", store=True
)
@api.depends("analytic_distribution")
def _compute_analytic_account_ids(self):
for record in self:
if not record.analytic_distribution:
record.analytic_account_ids = False
else:
record.update(
{
"analytic_account_ids": [
(6, 0, [int(k) for k in record.analytic_distribution])
]
}
)
def init(self):
"""
The join between accounts_partners subquery and account_move_line
@@ -32,9 +50,9 @@ class AccountMoveLine(models.Model):
)
@api.model
def search_count(self, args):
def search_count(self, domain, limit=None):
# In Big DataBase every time you change the domain widget this method
# takes a lot of time. This improves performance
if self.env.context.get("skip_search_count"):
return 0
return super(AccountMoveLine, self).search_count(args)
return super().search_count(domain, limit=limit)

View File

@@ -13,13 +13,15 @@ class IrActionsReport(models.Model):
return dict(self.env.context or {}, lang=lang) if lang else False
@api.model
def _render_qweb_html(self, docids, data=None):
def _render_qweb_html(self, report_ref, docids, data=None):
context = self._prepare_account_financial_report_context(data)
obj = self.with_context(**context) if context else self
return super(IrActionsReport, obj)._render_qweb_html(docids, data)
return super(IrActionsReport, obj)._render_qweb_html(
report_ref, docids, data=data
)
@api.model
def _render_xlsx(self, docids, data):
def _render_xlsx(self, report_ref, docids, data=None):
context = self._prepare_account_financial_report_context(data)
obj = self.with_context(**context) if context else self
return super(IrActionsReport, obj)._render_xlsx(docids, data)
return super(IrActionsReport, obj)._render_xlsx(report_ref, docids, data=data)