parent
0c6a1a0c5b
commit
d0fe1909f5
|
@ -324,6 +324,12 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||||
else "",
|
else "",
|
||||||
"tag_ids": move_line["analytic_tag_ids"],
|
"tag_ids": move_line["analytic_tag_ids"],
|
||||||
"currency_id": move_line["currency_id"],
|
"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,
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
move_line_data["ref"] == move_line_data["name"]
|
move_line_data["ref"] == move_line_data["name"]
|
||||||
|
@ -464,6 +470,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||||
"amount_currency",
|
"amount_currency",
|
||||||
"ref",
|
"ref",
|
||||||
"name",
|
"name",
|
||||||
|
"analytic_account_id",
|
||||||
]
|
]
|
||||||
move_lines = self.env["account.move.line"].search_read(
|
move_lines = self.env["account.move.line"].search_read(
|
||||||
domain=domain, fields=ml_fields
|
domain=domain, fields=ml_fields
|
||||||
|
@ -662,6 +669,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||||
"id": False,
|
"id": False,
|
||||||
"tag_ids": False,
|
"tag_ids": False,
|
||||||
"currency_id": False,
|
"currency_id": False,
|
||||||
|
"analytic_account_id": False,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
centralized_ml[jnl_id][month]["debit"] += move_line["debit"]
|
centralized_ml[jnl_id][month]["debit"] += move_line["debit"]
|
||||||
|
@ -782,6 +790,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
||||||
"only_posted_moves": data["only_posted_moves"],
|
"only_posted_moves": data["only_posted_moves"],
|
||||||
"hide_account_at_0": data["hide_account_at_0"],
|
"hide_account_at_0": data["hide_account_at_0"],
|
||||||
"show_analytic_tags": data["show_analytic_tags"],
|
"show_analytic_tags": data["show_analytic_tags"],
|
||||||
|
"show_cost_center": data["show_cost_center"],
|
||||||
"general_ledger": general_ledger,
|
"general_ledger": general_ledger,
|
||||||
"accounts_data": accounts_data,
|
"accounts_data": accounts_data,
|
||||||
"partners_data": partners_data,
|
"partners_data": partners_data,
|
||||||
|
|
|
@ -21,18 +21,26 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||||
return report_name
|
return report_name
|
||||||
|
|
||||||
def _get_report_columns(self, report):
|
def _get_report_columns(self, report):
|
||||||
res = {
|
res = [
|
||||||
0: {"header": _("Date"), "field": "date", "width": 11},
|
{"header": _("Date"), "field": "date", "width": 11},
|
||||||
1: {"header": _("Entry"), "field": "entry", "width": 18},
|
{"header": _("Entry"), "field": "entry", "width": 18},
|
||||||
2: {"header": _("Journal"), "field": "journal", "width": 8},
|
{"header": _("Journal"), "field": "journal", "width": 8},
|
||||||
3: {"header": _("Account"), "field": "account", "width": 9},
|
{"header": _("Account"), "field": "account", "width": 9},
|
||||||
4: {"header": _("Taxes"), "field": "taxes_description", "width": 15},
|
{"header": _("Taxes"), "field": "taxes_description", "width": 15},
|
||||||
5: {"header": _("Partner"), "field": "partner_name", "width": 25},
|
{"header": _("Partner"), "field": "partner_name", "width": 25},
|
||||||
6: {"header": _("Ref - Label"), "field": "ref_label", "width": 40},
|
{"header": _("Ref - Label"), "field": "ref_label", "width": 40},
|
||||||
7: {"header": _("Cost center"), "field": "cost_center", "width": 15},
|
]
|
||||||
8: {"header": _("Tags"), "field": "tags", "width": 10},
|
if report.show_cost_center:
|
||||||
9: {"header": _("Rec."), "field": "rec_name", "width": 15},
|
res += [
|
||||||
10: {
|
{"header": _("Cost center"), "field": "analytic_account", "width": 15},
|
||||||
|
]
|
||||||
|
if report.show_analytic_tags:
|
||||||
|
res += [
|
||||||
|
{"header": _("Tags"), "field": "tags", "width": 10},
|
||||||
|
]
|
||||||
|
res += [
|
||||||
|
{"header": _("Rec."), "field": "rec_name", "width": 15},
|
||||||
|
{
|
||||||
"header": _("Debit"),
|
"header": _("Debit"),
|
||||||
"field": "debit",
|
"field": "debit",
|
||||||
"field_initial_balance": "initial_debit",
|
"field_initial_balance": "initial_debit",
|
||||||
|
@ -40,7 +48,7 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||||
"type": "amount",
|
"type": "amount",
|
||||||
"width": 14,
|
"width": 14,
|
||||||
},
|
},
|
||||||
11: {
|
{
|
||||||
"header": _("Credit"),
|
"header": _("Credit"),
|
||||||
"field": "credit",
|
"field": "credit",
|
||||||
"field_initial_balance": "initial_credit",
|
"field_initial_balance": "initial_credit",
|
||||||
|
@ -48,7 +56,7 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||||
"type": "amount",
|
"type": "amount",
|
||||||
"width": 14,
|
"width": 14,
|
||||||
},
|
},
|
||||||
12: {
|
{
|
||||||
"header": _("Cumul. Bal."),
|
"header": _("Cumul. Bal."),
|
||||||
"field": "balance",
|
"field": "balance",
|
||||||
"field_initial_balance": "initial_balance",
|
"field_initial_balance": "initial_balance",
|
||||||
|
@ -56,17 +64,17 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||||
"type": "amount",
|
"type": "amount",
|
||||||
"width": 14,
|
"width": 14,
|
||||||
},
|
},
|
||||||
}
|
]
|
||||||
if report.foreign_currency:
|
if report.foreign_currency:
|
||||||
foreign_currency = {
|
res += [
|
||||||
13: {
|
{
|
||||||
"header": _("Cur."),
|
"header": _("Cur."),
|
||||||
"field": "currency_name",
|
"field": "currency_name",
|
||||||
"field_currency_balance": "currency_name",
|
"field_currency_balance": "currency_name",
|
||||||
"type": "currency_name",
|
"type": "currency_name",
|
||||||
"width": 7,
|
"width": 7,
|
||||||
},
|
},
|
||||||
14: {
|
{
|
||||||
"header": _("Amount cur."),
|
"header": _("Amount cur."),
|
||||||
"field": "bal_curr",
|
"field": "bal_curr",
|
||||||
"field_initial_balance": "initial_bal_curr",
|
"field_initial_balance": "initial_bal_curr",
|
||||||
|
@ -74,9 +82,11 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||||
"type": "amount_currency",
|
"type": "amount_currency",
|
||||||
"width": 14,
|
"width": 14,
|
||||||
},
|
},
|
||||||
}
|
]
|
||||||
res = {**res, **foreign_currency}
|
res_as_dict = {}
|
||||||
return res
|
for i, column in enumerate(res):
|
||||||
|
res_as_dict[i] = column
|
||||||
|
return res_as_dict
|
||||||
|
|
||||||
def _get_report_filters(self, report):
|
def _get_report_filters(self, report):
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -550,14 +550,14 @@
|
||||||
<t t-if="show_cost_center">
|
<t t-if="show_cost_center">
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<t t-set="res_model" t-value="'account.analytic.account'" />
|
<t t-set="res_model" t-value="'account.analytic.account'" />
|
||||||
<span t-if="line.cost_center">
|
<span t-if="line['analytic_account_id']">
|
||||||
<a
|
<a
|
||||||
t-att-data-active-id="line.move_line_id.analytic_account_id.id"
|
t-att-data-active-id="line['analytic_account_id']"
|
||||||
t-att-data-res-model="res_model"
|
t-att-data-res-model="res_model"
|
||||||
class="o_account_financial_reports_web_action"
|
class="o_account_financial_reports_web_action"
|
||||||
style="color: black;"
|
style="color: black;"
|
||||||
>
|
>
|
||||||
<t t-raw="line.cost_center" />
|
<t t-raw="line['analytic_account']" />
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -87,6 +87,8 @@ 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 Cost Center", default=True,)
|
||||||
|
|
||||||
@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):
|
||||||
if (
|
if (
|
||||||
|
@ -303,6 +305,7 @@ class GeneralLedgerReportWizard(models.TransientModel):
|
||||||
"partner_ids": self.partner_ids.ids,
|
"partner_ids": self.partner_ids.ids,
|
||||||
"show_partner_details": self.show_partner_details,
|
"show_partner_details": self.show_partner_details,
|
||||||
"cost_center_ids": self.cost_center_ids.ids,
|
"cost_center_ids": self.cost_center_ids.ids,
|
||||||
|
"show_cost_center": self.show_cost_center,
|
||||||
"analytic_tag_ids": self.analytic_tag_ids.ids,
|
"analytic_tag_ids": self.analytic_tag_ids.ids,
|
||||||
"journal_ids": self.account_journal_ids.ids,
|
"journal_ids": self.account_journal_ids.ids,
|
||||||
"centralize": self.centralize,
|
"centralize": self.centralize,
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
<field name="hide_account_at_0" />
|
<field name="hide_account_at_0" />
|
||||||
<field name="foreign_currency" />
|
<field name="foreign_currency" />
|
||||||
<field name="show_analytic_tags" />
|
<field name="show_analytic_tags" />
|
||||||
|
<field name="show_cost_center" />
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<notebook>
|
<notebook>
|
||||||
|
|
Loading…
Reference in New Issue