commit
85910a0ebc
|
@ -1,6 +1,6 @@
|
||||||
# Copyright 2019 ACSONE SA/NV (<http://acsone.eu>)
|
# Copyright 2019 ACSONE SA/NV (<http://acsone.eu>)
|
||||||
# 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).-
|
||||||
from odoo import models
|
from odoo import api, models
|
||||||
|
|
||||||
|
|
||||||
class AccountMoveLine(models.Model):
|
class AccountMoveLine(models.Model):
|
||||||
|
@ -30,3 +30,11 @@ class AccountMoveLine(models.Model):
|
||||||
CREATE INDEX account_move_line_account_id_partner_id_index
|
CREATE INDEX account_move_line_account_id_partner_id_index
|
||||||
ON account_move_line (account_id, partner_id)"""
|
ON account_move_line (account_id, partner_id)"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def search_count(self, args):
|
||||||
|
# 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)
|
||||||
|
|
|
@ -182,6 +182,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||||
fy_start_date,
|
fy_start_date,
|
||||||
analytic_tag_ids,
|
analytic_tag_ids,
|
||||||
cost_center_ids,
|
cost_center_ids,
|
||||||
|
extra_domain,
|
||||||
):
|
):
|
||||||
base_domain = []
|
base_domain = []
|
||||||
if company_id:
|
if company_id:
|
||||||
|
@ -194,6 +195,8 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||||
base_domain += [("analytic_tag_ids", "in", analytic_tag_ids)]
|
base_domain += [("analytic_tag_ids", "in", analytic_tag_ids)]
|
||||||
if cost_center_ids:
|
if cost_center_ids:
|
||||||
base_domain += [("analytic_account_id", "in", cost_center_ids)]
|
base_domain += [("analytic_account_id", "in", cost_center_ids)]
|
||||||
|
if extra_domain:
|
||||||
|
base_domain += extra_domain
|
||||||
initial_domain_bs = self._get_initial_balances_bs_ml_domain(
|
initial_domain_bs = self._get_initial_balances_bs_ml_domain(
|
||||||
account_ids, company_id, date_from, base_domain
|
account_ids, company_id, date_from, base_domain
|
||||||
)
|
)
|
||||||
|
@ -439,6 +442,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||||
partners_ids,
|
partners_ids,
|
||||||
analytic_tag_ids,
|
analytic_tag_ids,
|
||||||
cost_center_ids,
|
cost_center_ids,
|
||||||
|
extra_domain,
|
||||||
):
|
):
|
||||||
domain = self._get_period_domain(
|
domain = self._get_period_domain(
|
||||||
account_ids,
|
account_ids,
|
||||||
|
@ -450,6 +454,8 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||||
analytic_tag_ids,
|
analytic_tag_ids,
|
||||||
cost_center_ids,
|
cost_center_ids,
|
||||||
)
|
)
|
||||||
|
if extra_domain:
|
||||||
|
domain += extra_domain
|
||||||
ml_fields = [
|
ml_fields = [
|
||||||
"id",
|
"id",
|
||||||
"name",
|
"name",
|
||||||
|
@ -774,6 +780,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||||
only_posted_moves = data["only_posted_moves"]
|
only_posted_moves = data["only_posted_moves"]
|
||||||
unaffected_earnings_account = data["unaffected_earnings_account"]
|
unaffected_earnings_account = data["unaffected_earnings_account"]
|
||||||
fy_start_date = data["fy_start_date"]
|
fy_start_date = data["fy_start_date"]
|
||||||
|
extra_domain = data["domain"]
|
||||||
gen_ld_data, partners_data, partners_ids = self._get_initial_balance_data(
|
gen_ld_data, partners_data, partners_ids = self._get_initial_balance_data(
|
||||||
account_ids,
|
account_ids,
|
||||||
partner_ids,
|
partner_ids,
|
||||||
|
@ -785,6 +792,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||||
fy_start_date,
|
fy_start_date,
|
||||||
analytic_tag_ids,
|
analytic_tag_ids,
|
||||||
cost_center_ids,
|
cost_center_ids,
|
||||||
|
extra_domain,
|
||||||
)
|
)
|
||||||
centralize = data["centralize"]
|
centralize = data["centralize"]
|
||||||
(
|
(
|
||||||
|
@ -809,6 +817,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||||
partners_ids,
|
partners_ids,
|
||||||
analytic_tag_ids,
|
analytic_tag_ids,
|
||||||
cost_center_ids,
|
cost_center_ids,
|
||||||
|
extra_domain,
|
||||||
)
|
)
|
||||||
general_ledger = self._create_general_ledger(
|
general_ledger = self._create_general_ledger(
|
||||||
gen_ld_data,
|
gen_ld_data,
|
||||||
|
|
|
@ -101,7 +101,7 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||||
[
|
[
|
||||||
_("Target moves filter"),
|
_("Target moves filter"),
|
||||||
_("All posted entries")
|
_("All posted entries")
|
||||||
if report.target_move == "all"
|
if report.target_move == "posted"
|
||||||
else _("All entries"),
|
else _("All entries"),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
|
|
||||||
import time
|
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.exceptions import ValidationError
|
||||||
|
@ -87,6 +88,15 @@ class GeneralLedgerReportWizard(models.TransientModel):
|
||||||
)
|
)
|
||||||
show_partner_details = fields.Boolean(string="Show Partner Details", default=True,)
|
show_partner_details = fields.Boolean(string="Show Partner Details", default=True,)
|
||||||
show_cost_center = fields.Boolean(string="Show Analytic Account", default=True,)
|
show_cost_center = fields.Boolean(string="Show Analytic Account", default=True,)
|
||||||
|
domain = fields.Char(
|
||||||
|
string="Journal Items Domain",
|
||||||
|
default=[],
|
||||||
|
help="This domain will be used to select specific domain for Journal " "Items",
|
||||||
|
)
|
||||||
|
|
||||||
|
def _get_account_move_lines_domain(self):
|
||||||
|
domain = literal_eval(self.domain) if self.domain else []
|
||||||
|
return domain
|
||||||
|
|
||||||
@api.onchange("account_code_from", "account_code_to")
|
@api.onchange("account_code_from", "account_code_to")
|
||||||
def on_change_account_range(self):
|
def on_change_account_range(self):
|
||||||
|
@ -311,6 +321,7 @@ class GeneralLedgerReportWizard(models.TransientModel):
|
||||||
"fy_start_date": self.fy_start_date,
|
"fy_start_date": self.fy_start_date,
|
||||||
"unaffected_earnings_account": self.unaffected_earnings_account.id,
|
"unaffected_earnings_account": self.unaffected_earnings_account.id,
|
||||||
"account_financial_report_lang": self.env.lang,
|
"account_financial_report_lang": self.env.lang,
|
||||||
|
"domain": self._get_account_move_lines_domain(),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _export(self, report_type):
|
def _export(self, report_type):
|
||||||
|
|
|
@ -93,6 +93,16 @@
|
||||||
options="{'no_create': True}"
|
options="{'no_create': True}"
|
||||||
/>
|
/>
|
||||||
</page>
|
</page>
|
||||||
|
<page string="Additional Filtering">
|
||||||
|
<style
|
||||||
|
>.o_domain_show_selection_button {display: none}</style>
|
||||||
|
<field
|
||||||
|
name="domain"
|
||||||
|
widget="domain"
|
||||||
|
options="{'model': 'account.move.line', 'in_dialog': True}"
|
||||||
|
context="{'skip_search_count': 1}"
|
||||||
|
/>
|
||||||
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
|
Loading…
Reference in New Issue