[MIG] account_financial_report: Migration to 16.0
This commit is contained in:
@@ -16,12 +16,12 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
_description = "General Ledger Report"
|
||||
_inherit = "report.account_financial_report.abstract_report"
|
||||
|
||||
def _get_tags_data(self, tags_ids):
|
||||
tags = self.env["account.analytic.tag"].browse(tags_ids)
|
||||
tags_data = {}
|
||||
for tag in tags:
|
||||
tags_data.update({tag.id: {"name": tag.name}})
|
||||
return tags_data
|
||||
def _get_analytic_data(self, account_ids):
|
||||
analytic_accounts = self.env["account.analytic.account"].browse(account_ids)
|
||||
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)
|
||||
@@ -51,12 +51,16 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
return taxes_data
|
||||
|
||||
def _get_account_internal_types(self, grouped_by):
|
||||
return ["receivable", "payable"] if grouped_by != "taxes" else ["other"]
|
||||
return (
|
||||
["asset_receivable", "liability_payable"]
|
||||
if grouped_by != "taxes"
|
||||
else ["other"]
|
||||
)
|
||||
|
||||
def _get_acc_prt_accounts_ids(self, company_id, grouped_by):
|
||||
accounts_domain = [
|
||||
("company_id", "=", company_id),
|
||||
("internal_type", "in", self._get_account_internal_types(grouped_by)),
|
||||
("account_type", "in", self._get_account_internal_types(grouped_by)),
|
||||
]
|
||||
acc_prt_accounts = self.env["account.account"].search(accounts_domain)
|
||||
return acc_prt_accounts.ids
|
||||
@@ -66,7 +70,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
):
|
||||
accounts_domain = [
|
||||
("company_id", "=", company_id),
|
||||
("user_type_id.include_initial_balance", "=", True),
|
||||
("include_initial_balance", "=", True),
|
||||
]
|
||||
if account_ids:
|
||||
accounts_domain += [("id", "in", account_ids)]
|
||||
@@ -77,7 +81,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
domain += [("account_id", "in", accounts.ids)]
|
||||
if acc_prt:
|
||||
internal_types = self._get_account_internal_types(grouped_by)
|
||||
domain += [("account_id.internal_type", "in", internal_types)]
|
||||
domain += [("account_type", "in", internal_types)]
|
||||
return domain
|
||||
|
||||
def _get_initial_balances_pl_ml_domain(
|
||||
@@ -85,7 +89,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
):
|
||||
accounts_domain = [
|
||||
("company_id", "=", company_id),
|
||||
("user_type_id.include_initial_balance", "=", False),
|
||||
("include_initial_balance", "=", False),
|
||||
]
|
||||
if account_ids:
|
||||
accounts_domain += [("id", "in", account_ids)]
|
||||
@@ -99,12 +103,12 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
def _get_accounts_initial_balance(self, initial_domain_bs, initial_domain_pl):
|
||||
gl_initial_acc_bs = self.env["account.move.line"].read_group(
|
||||
domain=initial_domain_bs,
|
||||
fields=["account_id", "debit", "credit", "balance", "amount_currency"],
|
||||
fields=["account_id", "debit", "credit", "balance", "amount_currency:sum"],
|
||||
groupby=["account_id"],
|
||||
)
|
||||
gl_initial_acc_pl = self.env["account.move.line"].read_group(
|
||||
domain=initial_domain_pl,
|
||||
fields=["account_id", "debit", "credit", "balance", "amount_currency"],
|
||||
fields=["account_id", "debit", "credit", "balance", "amount_currency:sum"],
|
||||
groupby=["account_id"],
|
||||
)
|
||||
gl_initial_acc = gl_initial_acc_bs + gl_initial_acc_pl
|
||||
@@ -115,7 +119,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
):
|
||||
accounts_domain = [
|
||||
("company_id", "=", company_id),
|
||||
("user_type_id.include_initial_balance", "=", False),
|
||||
("include_initial_balance", "=", False),
|
||||
]
|
||||
if account_ids:
|
||||
accounts_domain += [("id", "in", account_ids)]
|
||||
@@ -134,7 +138,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
)
|
||||
initial_balances = self.env["account.move.line"].read_group(
|
||||
domain=domain,
|
||||
fields=["account_id", "debit", "credit", "balance", "amount_currency"],
|
||||
fields=["account_id", "debit", "credit", "balance", "amount_currency:sum"],
|
||||
groupby=["account_id"],
|
||||
)
|
||||
pl_initial_balance = {
|
||||
@@ -192,7 +196,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
"debit",
|
||||
"credit",
|
||||
"balance",
|
||||
"amount_currency",
|
||||
"amount_currency:sum",
|
||||
],
|
||||
groupby=["account_id", "partner_id"],
|
||||
lazy=False,
|
||||
@@ -221,7 +225,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
"debit",
|
||||
"credit",
|
||||
"balance",
|
||||
"amount_currency",
|
||||
"amount_currency:sum",
|
||||
"tax_line_id",
|
||||
],
|
||||
groupby=["account_id"],
|
||||
@@ -253,7 +257,6 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
only_posted_moves,
|
||||
unaffected_earnings_account,
|
||||
fy_start_date,
|
||||
analytic_tag_ids,
|
||||
cost_center_ids,
|
||||
extra_domain,
|
||||
grouped_by,
|
||||
@@ -271,10 +274,8 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
base_domain += [("move_id.state", "=", "posted")]
|
||||
else:
|
||||
base_domain += [("move_id.state", "in", ["posted", "draft"])]
|
||||
if analytic_tag_ids:
|
||||
base_domain += [("analytic_tag_ids", "in", analytic_tag_ids)]
|
||||
if cost_center_ids:
|
||||
base_domain += [("analytic_account_id", "in", cost_center_ids)]
|
||||
base_domain += [("analytic_account_ids", "in", cost_center_ids)]
|
||||
if extra_domain:
|
||||
base_domain += extra_domain
|
||||
gl_initial_acc = self._get_gl_initial_acc(
|
||||
@@ -335,14 +336,8 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
"rec_name": move_line["full_reconcile_id"][1]
|
||||
if move_line["full_reconcile_id"]
|
||||
else "",
|
||||
"tag_ids": move_line["analytic_tag_ids"],
|
||||
"currency_id": move_line["currency_id"],
|
||||
"analytic_account": move_line["analytic_account_id"][1]
|
||||
if move_line["analytic_account_id"]
|
||||
else "",
|
||||
"analytic_account_id": move_line["analytic_account_id"][0]
|
||||
if move_line["analytic_account_id"]
|
||||
else False,
|
||||
"analytic_distribution": move_line["analytic_distribution"] or {},
|
||||
}
|
||||
if (
|
||||
move_line_data["ref"] == move_line_data["name"]
|
||||
@@ -365,11 +360,10 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
only_posted_moves,
|
||||
date_to,
|
||||
date_from,
|
||||
analytic_tag_ids,
|
||||
cost_center_ids,
|
||||
):
|
||||
domain = [
|
||||
("display_type", "=", False),
|
||||
("display_type", "not in", ["line_note", "line_section"]),
|
||||
("date", ">=", date_from),
|
||||
("date", "<=", date_to),
|
||||
]
|
||||
@@ -383,10 +377,9 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
domain += [("move_id.state", "=", "posted")]
|
||||
else:
|
||||
domain += [("move_id.state", "in", ["posted", "draft"])]
|
||||
if analytic_tag_ids:
|
||||
domain += [("analytic_tag_ids", "in", analytic_tag_ids)]
|
||||
|
||||
if cost_center_ids:
|
||||
domain += [("analytic_account_id", "in", cost_center_ids)]
|
||||
domain += [("analytic_account_ids", "in", cost_center_ids)]
|
||||
return domain
|
||||
|
||||
def _initialize_data(self, foreign_currency):
|
||||
@@ -450,7 +443,6 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
date_from,
|
||||
date_to,
|
||||
gen_ld_data,
|
||||
analytic_tag_ids,
|
||||
cost_center_ids,
|
||||
extra_domain,
|
||||
grouped_by,
|
||||
@@ -462,7 +454,6 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
only_posted_moves,
|
||||
date_to,
|
||||
date_from,
|
||||
analytic_tag_ids,
|
||||
cost_center_ids,
|
||||
)
|
||||
if extra_domain:
|
||||
@@ -482,11 +473,10 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
"full_reconcile_id",
|
||||
"tax_ids",
|
||||
"tax_line_id",
|
||||
"analytic_tag_ids",
|
||||
"amount_currency",
|
||||
"ref",
|
||||
"name",
|
||||
"analytic_account_id",
|
||||
"analytic_distribution",
|
||||
]
|
||||
move_lines = self.env["account.move.line"].search_read(
|
||||
domain=domain, fields=ml_fields
|
||||
@@ -494,15 +484,15 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
journal_ids = set()
|
||||
full_reconcile_ids = set()
|
||||
taxes_ids = set()
|
||||
tags_ids = set()
|
||||
analytic_ids = set()
|
||||
full_reconcile_data = {}
|
||||
acc_prt_account_ids = self._get_acc_prt_accounts_ids(company_id, grouped_by)
|
||||
for move_line in move_lines:
|
||||
journal_ids.add(move_line["journal_id"][0])
|
||||
for tax_id in move_line["tax_ids"]:
|
||||
taxes_ids.add(tax_id)
|
||||
for analytic_tag_id in move_line["analytic_tag_ids"]:
|
||||
tags_ids.add(analytic_tag_id)
|
||||
for analytic_account in move_line["analytic_distribution"] or {}:
|
||||
analytic_ids.add(int(analytic_account))
|
||||
if move_line["full_reconcile_id"]:
|
||||
rec_id = move_line["full_reconcile_id"][0]
|
||||
if rec_id not in full_reconcile_ids:
|
||||
@@ -563,7 +553,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
journals_data = self._get_journals_data(list(journal_ids))
|
||||
accounts_data = self._get_accounts_data(gen_ld_data.keys())
|
||||
taxes_data = self._get_taxes_data(list(taxes_ids))
|
||||
tags_data = self._get_tags_data(list(tags_ids))
|
||||
analytic_data = self._get_analytic_data(list(analytic_ids))
|
||||
rec_after_date_to_ids = self._get_reconciled_after_date_to_ids(
|
||||
full_reconcile_data.keys(), date_to
|
||||
)
|
||||
@@ -573,7 +563,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
journals_data,
|
||||
full_reconcile_data,
|
||||
taxes_data,
|
||||
tags_data,
|
||||
analytic_data,
|
||||
rec_after_date_to_ids,
|
||||
)
|
||||
|
||||
@@ -756,9 +746,8 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
"tax_line_id": False,
|
||||
"full_reconcile_id": False,
|
||||
"id": False,
|
||||
"tag_ids": False,
|
||||
"currency_id": False,
|
||||
"analytic_account_id": False,
|
||||
"analytic_distribution": {},
|
||||
}
|
||||
)
|
||||
centralized_ml[jnl_id][month]["debit"] += move_line["debit"]
|
||||
@@ -802,7 +791,6 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
date_from = data["date_from"]
|
||||
partner_ids = data["partner_ids"]
|
||||
account_ids = data["account_ids"]
|
||||
analytic_tag_ids = data["analytic_tag_ids"]
|
||||
cost_center_ids = data["cost_center_ids"]
|
||||
grouped_by = data["grouped_by"]
|
||||
hide_account_at_0 = data["hide_account_at_0"]
|
||||
@@ -820,7 +808,6 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
only_posted_moves,
|
||||
unaffected_earnings_account,
|
||||
fy_start_date,
|
||||
analytic_tag_ids,
|
||||
cost_center_ids,
|
||||
extra_domain,
|
||||
grouped_by,
|
||||
@@ -832,7 +819,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
journals_data,
|
||||
full_reconcile_data,
|
||||
taxes_data,
|
||||
tags_data,
|
||||
analytic_data,
|
||||
rec_after_date_to_ids,
|
||||
) = self._get_period_ml_data(
|
||||
account_ids,
|
||||
@@ -843,7 +830,6 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
date_from,
|
||||
date_to,
|
||||
gen_ld_data,
|
||||
analytic_tag_ids,
|
||||
cost_center_ids,
|
||||
extra_domain,
|
||||
grouped_by,
|
||||
@@ -883,7 +869,6 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
"date_to": data["date_to"],
|
||||
"only_posted_moves": data["only_posted_moves"],
|
||||
"hide_account_at_0": data["hide_account_at_0"],
|
||||
"show_analytic_tags": data["show_analytic_tags"],
|
||||
"show_cost_center": data["show_cost_center"],
|
||||
"general_ledger": general_ledger,
|
||||
"accounts_data": accounts_data,
|
||||
@@ -891,7 +876,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||
"full_reconcile_data": full_reconcile_data,
|
||||
"taxes_data": taxes_data,
|
||||
"centralize": centralize,
|
||||
"tags_data": tags_data,
|
||||
"analytic_data": analytic_data,
|
||||
"filter_partner_ids": True if partner_ids else False,
|
||||
"currency_model": self.env["res.currency"],
|
||||
}
|
||||
|
||||
@@ -35,15 +35,11 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||
if report.show_cost_center:
|
||||
res += [
|
||||
{
|
||||
"header": _("Analytic Account"),
|
||||
"field": "analytic_account",
|
||||
"header": _("Analytic Distribution"),
|
||||
"field": "analytic_distribution",
|
||||
"width": 20,
|
||||
},
|
||||
]
|
||||
if report.show_analytic_tags:
|
||||
res += [
|
||||
{"header": _("Tags"), "field": "tags", "width": 10},
|
||||
]
|
||||
res += [
|
||||
{"header": _("Rec."), "field": "rec_name", "width": 15},
|
||||
{
|
||||
@@ -113,10 +109,6 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||
_("Hide") if report.hide_account_at_0 else _("Show"),
|
||||
],
|
||||
[_("Centralize filter"), _("Yes") if report.centralize else _("No")],
|
||||
[
|
||||
_("Show analytic tags"),
|
||||
_("Yes") if report.show_analytic_tags else _("No"),
|
||||
],
|
||||
[
|
||||
_("Show foreign currency"),
|
||||
_("Yes") if report.foreign_currency else _("No"),
|
||||
@@ -147,7 +139,7 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||
accounts_data = res_data["accounts_data"]
|
||||
journals_data = res_data["journals_data"]
|
||||
taxes_data = res_data["taxes_data"]
|
||||
tags_data = res_data["tags_data"]
|
||||
analytic_data = res_data["analytic_data"]
|
||||
filter_partner_ids = res_data["filter_partner_ids"]
|
||||
foreign_currency = res_data["foreign_currency"]
|
||||
company_currency = report.company_id.currency_id
|
||||
@@ -196,17 +188,25 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||
)
|
||||
if line["ref_label"] != "Centralized entries":
|
||||
taxes_description = ""
|
||||
tags = ""
|
||||
analytic_distribution = ""
|
||||
for tax_id in line["tax_ids"]:
|
||||
taxes_description += taxes_data[tax_id]["tax_name"] + " "
|
||||
if line["tax_line_id"]:
|
||||
taxes_description += line["tax_line_id"][1]
|
||||
for tag_id in line["tag_ids"]:
|
||||
tags += tags_data[tag_id]["name"] + " "
|
||||
for account_id, value in line["analytic_distribution"].items():
|
||||
if value < 100:
|
||||
analytic_distribution += "%s %d%% " % (
|
||||
analytic_data[int(account_id)]["name"],
|
||||
value,
|
||||
)
|
||||
else:
|
||||
analytic_distribution += (
|
||||
"%s " % analytic_data[int(account_id)]["name"]
|
||||
)
|
||||
line.update(
|
||||
{
|
||||
"taxes_description": taxes_description,
|
||||
"tags": tags,
|
||||
"analytic_distribution": analytic_distribution,
|
||||
}
|
||||
)
|
||||
if (
|
||||
@@ -282,17 +282,27 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||
)
|
||||
if line["ref_label"] != "Centralized entries":
|
||||
taxes_description = ""
|
||||
tags = ""
|
||||
analytic_distribution = ""
|
||||
for tax_id in line["tax_ids"]:
|
||||
taxes_description += (
|
||||
taxes_data[tax_id]["tax_name"] + " "
|
||||
)
|
||||
for tag_id in line["tag_ids"]:
|
||||
tags += tags_data[tag_id]["name"] + " "
|
||||
for account_id, value in line[
|
||||
"analytic_distribution"
|
||||
].items():
|
||||
if value < 100:
|
||||
analytic_distribution += "%s %d%% " % (
|
||||
analytic_data[int(account_id)]["name"],
|
||||
value,
|
||||
)
|
||||
else:
|
||||
analytic_distribution += (
|
||||
"%s " % analytic_data[int(account_id)]["name"]
|
||||
)
|
||||
line.update(
|
||||
{
|
||||
"taxes_description": taxes_description,
|
||||
"tags": tags,
|
||||
"analytic_distribution": analytic_distribution,
|
||||
}
|
||||
)
|
||||
if (
|
||||
|
||||
@@ -81,7 +81,10 @@ class JournalLedgerReport(models.AbstractModel):
|
||||
return moves.ids, Moves, move_data
|
||||
|
||||
def _get_move_lines_domain(self, move_ids, wizard, journal_ids):
|
||||
return [("display_type", "=", False), ("move_id", "in", move_ids)]
|
||||
return [
|
||||
("display_type", "not in", ["line_note", "line_section"]),
|
||||
("move_id", "in", move_ids),
|
||||
]
|
||||
|
||||
def _get_move_lines_order(self, move_ids, wizard, journal_ids):
|
||||
"""Add `move_id` to make sure the order of the records is correct
|
||||
@@ -134,7 +137,7 @@ class JournalLedgerReport(models.AbstractModel):
|
||||
return {
|
||||
"name": account.name,
|
||||
"code": account.code,
|
||||
"internal_type": account.internal_type,
|
||||
"account_type": account.account_type,
|
||||
}
|
||||
|
||||
def _get_partner_data(self, partners):
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
<!-- Defines global variables used by internal layout -->
|
||||
<t t-set="title">
|
||||
General Ledger -
|
||||
<t t-raw="company_name" />
|
||||
<t t-out="company_name" />
|
||||
-
|
||||
<t t-raw="currency_name" />
|
||||
<t t-out="currency_name" />
|
||||
</t>
|
||||
<div class="page">
|
||||
<div class="row">
|
||||
@@ -35,9 +35,9 @@
|
||||
<!-- Display account header -->
|
||||
<div class="act_as_table list_table" style="margin-top: 10px;" />
|
||||
<div class="act_as_caption account_title" style="width: 100%">
|
||||
<span t-esc="account['code']" /> - <span
|
||||
t-esc="account['name']"
|
||||
/>
|
||||
<span t-esc="account['code']" />
|
||||
-
|
||||
<span t-esc="account['name']" />
|
||||
</div>
|
||||
<t t-if="'list_grouped' not in account">
|
||||
<!-- Display account move lines without partner regroup -->
|
||||
@@ -109,7 +109,6 @@
|
||||
<div class="act_as_cell">Target moves filter</div>
|
||||
<div class="act_as_cell">Account balance at 0 filter</div>
|
||||
<div class="act_as_cell">Centralize filter</div>
|
||||
<div class="act_as_cell">Show analytic tags</div>
|
||||
</div>
|
||||
<div class="act_as_row">
|
||||
<div class="act_as_cell">
|
||||
@@ -130,10 +129,6 @@
|
||||
<t t-if="centralize">Yes</t>
|
||||
<t t-if="not centralize">No</t>
|
||||
</div>
|
||||
<div class="act_as_cell">
|
||||
<t t-if="show_analytic_tags">Yes</t>
|
||||
<t t-if="not show_analytic_tags">No</t>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -164,7 +159,7 @@
|
||||
<t t-if="show_cost_center">
|
||||
<!--## cost_center-->
|
||||
<div class="act_as_cell" style="width: 8.03%;">
|
||||
Analytic Account
|
||||
Analytic Distribution
|
||||
</div>
|
||||
</t>
|
||||
<t t-if="show_analytic_tags">
|
||||
@@ -186,12 +181,11 @@
|
||||
<div
|
||||
class="act_as_cell amount"
|
||||
style="width: 3.63%;"
|
||||
>Amount cur.</div>
|
||||
>Amount cur.
|
||||
</div>
|
||||
<!--## amount_currency cumulated-->
|
||||
<div
|
||||
class="act_as_cell amount"
|
||||
style="width: 3.63%;"
|
||||
>Cumul cur.</div>
|
||||
<div class="act_as_cell amount" style="width: 3.63%;">Cumul cur.
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
@@ -246,7 +240,7 @@
|
||||
res-model="account.move.line"
|
||||
>
|
||||
<t
|
||||
t-raw="account_or_group_item_object['init_bal']['debit']"
|
||||
t-out="account_or_group_item_object['init_bal']['debit']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': company_currency}"
|
||||
/>
|
||||
</span>
|
||||
@@ -257,7 +251,7 @@
|
||||
res-model="account.move.line"
|
||||
>
|
||||
<t
|
||||
t-raw="account_or_group_item_object['init_bal']['debit']"
|
||||
t-out="account_or_group_item_object['init_bal']['debit']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': company_currency}"
|
||||
/>
|
||||
</span>
|
||||
@@ -272,7 +266,7 @@
|
||||
res-model="account.move.line"
|
||||
>
|
||||
<t
|
||||
t-raw="account_or_group_item_object['init_bal']['credit']"
|
||||
t-out="account_or_group_item_object['init_bal']['credit']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': company_currency}"
|
||||
/>
|
||||
</span>
|
||||
@@ -283,7 +277,7 @@
|
||||
res-model="account.move.line"
|
||||
>
|
||||
<t
|
||||
t-raw="account_or_group_item_object['init_bal']['credit']"
|
||||
t-out="account_or_group_item_object['init_bal']['credit']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': company_currency}"
|
||||
/>
|
||||
</span>
|
||||
@@ -294,7 +288,7 @@
|
||||
<t t-if="type == 'account_type'">
|
||||
<span t-att-domain="misc_domain" res-model="account.move.line">
|
||||
<t
|
||||
t-raw="account_or_group_item_object['init_bal']['balance']"
|
||||
t-out="account_or_group_item_object['init_bal']['balance']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': company_currency}"
|
||||
/>
|
||||
</span>
|
||||
@@ -305,7 +299,7 @@
|
||||
res-model="account.move.line"
|
||||
>
|
||||
<t
|
||||
t-raw="account_or_group_item_object['init_bal']['balance']"
|
||||
t-out="account_or_group_item_object['init_bal']['balance']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': company_currency}"
|
||||
/>
|
||||
</span>
|
||||
@@ -320,7 +314,7 @@
|
||||
res-model="account.move.line"
|
||||
>
|
||||
<t
|
||||
t-raw="account_or_group_item_object['init_bal']['bal_curr']"
|
||||
t-out="account_or_group_item_object['init_bal']['bal_curr']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': account['currency_id']}"
|
||||
/>
|
||||
</span>
|
||||
@@ -355,7 +349,7 @@
|
||||
res-model="account.move.line"
|
||||
>
|
||||
<t
|
||||
t-raw="account_or_group_item_object['init_bal']['bal_curr']"
|
||||
t-out="account_or_group_item_object['init_bal']['bal_curr']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': account['currency_id']}"
|
||||
/>
|
||||
</span>
|
||||
@@ -409,7 +403,7 @@
|
||||
res-model="account.move"
|
||||
view-type="form"
|
||||
>
|
||||
<t t-raw="line['entry']" />
|
||||
<t t-out="line['entry']" />
|
||||
</span>
|
||||
</t>
|
||||
</div>
|
||||
@@ -421,7 +415,7 @@
|
||||
view-type="form"
|
||||
>
|
||||
<t
|
||||
t-raw="o._get_atr_from_dict(line['journal_id'], journals_data, 'code')"
|
||||
t-out="o._get_atr_from_dict(line['journal_id'], journals_data, 'code')"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
@@ -432,7 +426,7 @@
|
||||
res-model="account.account"
|
||||
view-type="form"
|
||||
>
|
||||
<t t-raw="account['code']" />
|
||||
<t t-out="account['code']" />
|
||||
</span>
|
||||
</div>
|
||||
<!--## taxes-->
|
||||
@@ -456,7 +450,7 @@
|
||||
res-model="res.partner"
|
||||
view-type="form"
|
||||
>
|
||||
<t t-raw="line['partner_name']" />
|
||||
<t t-out="line['partner_name']" />
|
||||
</span>
|
||||
</t>
|
||||
</div>
|
||||
@@ -468,26 +462,40 @@
|
||||
res-model="account.move.line"
|
||||
view-type="form"
|
||||
>
|
||||
<t t-raw="line['ref_label']" />
|
||||
<t t-out="line['ref_label']" />
|
||||
</span>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<span>
|
||||
<t t-raw="line['ref_label']" />
|
||||
<t t-out="line['ref_label']" />
|
||||
</span>
|
||||
</t>
|
||||
</div>
|
||||
<!--## cost_center-->
|
||||
<t t-if="show_cost_center">
|
||||
<div class="act_as_cell left">
|
||||
<t t-if="line['analytic_account_id']">
|
||||
<span
|
||||
t-att-res-id="line['analytic_account_id']"
|
||||
res-model="account.analytic.account"
|
||||
view-type="form"
|
||||
>
|
||||
<t t-raw="line['analytic_account']" />
|
||||
</span>
|
||||
<t
|
||||
t-foreach="line['analytic_distribution']"
|
||||
t-as="analytic_id"
|
||||
>
|
||||
<div>
|
||||
<span
|
||||
t-att-res-id="analytic_id"
|
||||
res-model="account.analytic.account"
|
||||
view-type="form"
|
||||
>
|
||||
<t
|
||||
t-esc="o._get_atr_from_dict(int(analytic_id), analytic_data, 'name')"
|
||||
/>
|
||||
<t
|
||||
t-if="int(line['analytic_distribution'][analytic_id]) < 100"
|
||||
>
|
||||
<t
|
||||
t-esc="int(line['analytic_distribution'][analytic_id])"
|
||||
/>%
|
||||
</t>
|
||||
</span>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
@@ -511,7 +519,7 @@
|
||||
res-model="account.full.reconcile"
|
||||
view-type="form"
|
||||
>
|
||||
<t t-raw="line['rec_name']" />
|
||||
<t t-out="line['rec_name']" />
|
||||
</span>
|
||||
</t>
|
||||
</div>
|
||||
@@ -524,7 +532,7 @@
|
||||
view-type="form"
|
||||
>
|
||||
<t
|
||||
t-raw="line['debit']"
|
||||
t-out="line['debit']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||
/>
|
||||
</span>
|
||||
@@ -532,7 +540,7 @@
|
||||
<t t-else="">
|
||||
<span>
|
||||
<t
|
||||
t-raw="line['debit']"
|
||||
t-out="line['debit']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||
/>
|
||||
</span>
|
||||
@@ -547,7 +555,7 @@
|
||||
view-type="form"
|
||||
>
|
||||
<t
|
||||
t-raw="line['credit']"
|
||||
t-out="line['credit']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||
/>
|
||||
</span>
|
||||
@@ -555,7 +563,7 @@
|
||||
<t t-else="">
|
||||
<span>
|
||||
<t
|
||||
t-raw="line['credit']"
|
||||
t-out="line['credit']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||
/>
|
||||
</span>
|
||||
@@ -570,7 +578,7 @@
|
||||
view-type="form"
|
||||
>
|
||||
<t
|
||||
t-raw="line['balance']"
|
||||
t-out="line['balance']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||
/>
|
||||
</span>
|
||||
@@ -578,7 +586,7 @@
|
||||
<t t-else="">
|
||||
<span>
|
||||
<t
|
||||
t-raw="line['balance']"
|
||||
t-out="line['balance']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||
/>
|
||||
</span>
|
||||
@@ -601,7 +609,7 @@
|
||||
t-att-res-id="line['id']"
|
||||
res-model="account.move.line"
|
||||
view-type="form"
|
||||
t-raw="line['bal_curr']"
|
||||
t-out="line['bal_curr']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': line_currency}"
|
||||
t-if="line_currency!=company_currency"
|
||||
/>
|
||||
@@ -612,7 +620,7 @@
|
||||
t-att-res-id="line['id']"
|
||||
res-model="account.move.line"
|
||||
view-type="form"
|
||||
t-raw="total_bal_curr"
|
||||
t-out="total_bal_curr"
|
||||
t-options="{'widget': 'monetary', 'display_currency': line_currency}"
|
||||
t-if="line_currency!=company_currency"
|
||||
/>
|
||||
@@ -636,14 +644,12 @@
|
||||
<!--## date-->
|
||||
<t t-if='type == "account_type"'>
|
||||
<div class="act_as_cell first_column" style="width: 41.32%;">
|
||||
<span t-esc="account['code']" /> - <span
|
||||
t-esc="account['name']"
|
||||
/>
|
||||
<span t-esc="account['code']" />
|
||||
-
|
||||
<span t-esc="account['name']" />
|
||||
</div>
|
||||
<div class="act_as_cell right" style="width: 16.9%;">Ending balance
|
||||
</div>
|
||||
<div
|
||||
class="act_as_cell right"
|
||||
style="width: 16.9%;"
|
||||
>Ending balance</div>
|
||||
</t>
|
||||
<t t-if='type == "grouped_type"'>
|
||||
<div class="act_as_cell first_column" style="width: 41.32%;" />
|
||||
@@ -706,7 +712,7 @@
|
||||
style="color: black;"
|
||||
>
|
||||
<t
|
||||
t-raw="account_or_group_item_object['fin_bal']['bal_curr']"
|
||||
t-out="account_or_group_item_object['fin_bal']['bal_curr']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': account['currency_id']}"
|
||||
/>
|
||||
</a>
|
||||
@@ -753,7 +759,7 @@
|
||||
style="color: black;"
|
||||
>
|
||||
<t
|
||||
t-raw="account_or_group_item_object['fin_bal']['bal_curr']"
|
||||
t-out="account_or_group_item_object['fin_bal']['bal_curr']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': account['currency_id']}"
|
||||
/>
|
||||
</a>
|
||||
|
||||
@@ -306,10 +306,7 @@
|
||||
</t>
|
||||
</div>
|
||||
<div class="act_as_cell amount" name="amount_currency">
|
||||
<t
|
||||
t-if="move_line['amount_currency']"
|
||||
t-options="{'widget': 'float', 'precision': 2}"
|
||||
>
|
||||
<t t-if="move_line['amount_currency']">
|
||||
<span
|
||||
t-esc="move_line['amount_currency']"
|
||||
t-options="{'widget': 'float', 'precision': 2}"
|
||||
|
||||
@@ -25,7 +25,7 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
):
|
||||
accounts_domain = [
|
||||
("company_id", "=", company_id),
|
||||
("user_type_id.include_initial_balance", "=", True),
|
||||
("include_initial_balance", "=", True),
|
||||
]
|
||||
if account_ids:
|
||||
accounts_domain += [("id", "in", account_ids)]
|
||||
@@ -43,7 +43,13 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
else:
|
||||
domain += [("move_id.state", "in", ["posted", "draft"])]
|
||||
if show_partner_details:
|
||||
domain += [("account_id.internal_type", "in", ["receivable", "payable"])]
|
||||
domain += [
|
||||
(
|
||||
"account_id.account_type",
|
||||
"in",
|
||||
["asset_receivable", "liability_payable"],
|
||||
)
|
||||
]
|
||||
return domain
|
||||
|
||||
def _get_initial_balances_pl_ml_domain(
|
||||
@@ -59,7 +65,7 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
):
|
||||
accounts_domain = [
|
||||
("company_id", "=", company_id),
|
||||
("user_type_id.include_initial_balance", "=", False),
|
||||
("include_initial_balance", "=", False),
|
||||
]
|
||||
if account_ids:
|
||||
accounts_domain += [("id", "in", account_ids)]
|
||||
@@ -77,7 +83,13 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
else:
|
||||
domain += [("move_id.state", "in", ["posted", "draft"])]
|
||||
if show_partner_details:
|
||||
domain += [("account_id.internal_type", "in", ["receivable", "payable"])]
|
||||
domain += [
|
||||
(
|
||||
"account_id.account_type",
|
||||
"in",
|
||||
["asset_receivable", "liability_payable"],
|
||||
)
|
||||
]
|
||||
return domain
|
||||
|
||||
@api.model
|
||||
@@ -93,7 +105,7 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
show_partner_details,
|
||||
):
|
||||
domain = [
|
||||
("display_type", "=", False),
|
||||
("display_type", "not in", ["line_note", "line_section"]),
|
||||
("date", ">=", date_from),
|
||||
("date", "<=", date_to),
|
||||
]
|
||||
@@ -110,7 +122,13 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
else:
|
||||
domain += [("move_id.state", "in", ["posted", "draft"])]
|
||||
if show_partner_details:
|
||||
domain += [("account_id.internal_type", "in", ["receivable", "payable"])]
|
||||
domain += [
|
||||
(
|
||||
"account_id.account_type",
|
||||
"in",
|
||||
["asset_receivable", "liability_payable"],
|
||||
)
|
||||
]
|
||||
return domain
|
||||
|
||||
def _get_initial_balance_fy_pl_ml_domain(
|
||||
@@ -125,7 +143,7 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
):
|
||||
accounts_domain = [
|
||||
("company_id", "=", company_id),
|
||||
("user_type_id.include_initial_balance", "=", False),
|
||||
("include_initial_balance", "=", False),
|
||||
]
|
||||
if account_ids:
|
||||
accounts_domain += [("id", "in", account_ids)]
|
||||
@@ -143,7 +161,13 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
else:
|
||||
domain += [("move_id.state", "in", ["posted", "draft"])]
|
||||
if show_partner_details:
|
||||
domain += [("account_id.internal_type", "in", ["receivable", "payable"])]
|
||||
domain += [
|
||||
(
|
||||
"account_id.account_type",
|
||||
"in",
|
||||
["asset_receivable", "liability_payable"],
|
||||
)
|
||||
]
|
||||
return domain
|
||||
|
||||
def _get_pl_initial_balance(
|
||||
@@ -168,7 +192,7 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
)
|
||||
initial_balances = self.env["account.move.line"].read_group(
|
||||
domain=domain,
|
||||
fields=["account_id", "balance", "amount_currency"],
|
||||
fields=["account_id", "balance", "amount_currency:sum"],
|
||||
groupby=["account_id"],
|
||||
)
|
||||
pl_initial_balance = 0.0
|
||||
@@ -367,7 +391,7 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
)
|
||||
tb_initial_acc_bs = self.env["account.move.line"].read_group(
|
||||
domain=initial_domain_bs,
|
||||
fields=["account_id", "balance", "amount_currency"],
|
||||
fields=["account_id", "balance", "amount_currency:sum"],
|
||||
groupby=["account_id"],
|
||||
)
|
||||
initial_domain_pl = self._get_initial_balances_pl_ml_domain(
|
||||
@@ -382,7 +406,7 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
)
|
||||
tb_initial_acc_pl = self.env["account.move.line"].read_group(
|
||||
domain=initial_domain_pl,
|
||||
fields=["account_id", "balance", "amount_currency"],
|
||||
fields=["account_id", "balance", "amount_currency:sum"],
|
||||
groupby=["account_id"],
|
||||
)
|
||||
tb_initial_acc_rg = tb_initial_acc_bs + tb_initial_acc_pl
|
||||
@@ -412,20 +436,20 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
)
|
||||
tb_period_acc = self.env["account.move.line"].read_group(
|
||||
domain=period_domain,
|
||||
fields=["account_id", "debit", "credit", "balance", "amount_currency"],
|
||||
fields=["account_id", "debit", "credit", "balance", "amount_currency:sum"],
|
||||
groupby=["account_id"],
|
||||
)
|
||||
|
||||
if show_partner_details:
|
||||
tb_initial_prt_bs = self.env["account.move.line"].read_group(
|
||||
domain=initial_domain_bs,
|
||||
fields=["account_id", "partner_id", "balance", "amount_currency"],
|
||||
fields=["account_id", "partner_id", "balance", "amount_currency:sum"],
|
||||
groupby=["account_id", "partner_id"],
|
||||
lazy=False,
|
||||
)
|
||||
tb_initial_prt_pl = self.env["account.move.line"].read_group(
|
||||
domain=initial_domain_pl,
|
||||
fields=["account_id", "partner_id", "balance", "amount_currency"],
|
||||
fields=["account_id", "partner_id", "balance", "amount_currency:sum"],
|
||||
groupby=["account_id", "partner_id"],
|
||||
)
|
||||
tb_initial_prt = tb_initial_prt_bs + tb_initial_prt_pl
|
||||
@@ -439,7 +463,7 @@ class TrialBalanceReport(models.AbstractModel):
|
||||
"debit",
|
||||
"credit",
|
||||
"balance",
|
||||
"amount_currency",
|
||||
"amount_currency:sum",
|
||||
],
|
||||
groupby=["account_id", "partner_id"],
|
||||
lazy=False,
|
||||
|
||||
@@ -66,7 +66,6 @@ class VATReport(models.AbstractModel):
|
||||
"balance",
|
||||
"tax_line_id",
|
||||
"tax_ids",
|
||||
"analytic_tag_ids",
|
||||
]
|
||||
tax_move_lines = self.env["account.move.line"].search_read(
|
||||
domain=tax_domain,
|
||||
|
||||
Reference in New Issue
Block a user