[IMP] account_financial_report: added 'auto sequence' option in Journal Ledger
parent
728e8dda08
commit
56e824f05b
|
@ -24,5 +24,10 @@
|
||||||
* João Marques
|
* João Marques
|
||||||
* Alexandre D. Díaz
|
* Alexandre D. Díaz
|
||||||
|
|
||||||
|
* `Sygel <https://www.sygel.es>`__:
|
||||||
|
|
||||||
|
* Harald Panten
|
||||||
|
* Valentin Vinagre
|
||||||
|
|
||||||
Much of the work in this module was done at a sprint in Sorrento, Italy in
|
Much of the work in this module was done at a sprint in Sorrento, Italy in
|
||||||
April 2016.
|
April 2016.
|
||||||
|
|
|
@ -84,7 +84,7 @@ class JournalLedgerReport(models.AbstractModel):
|
||||||
def _get_move_lines_order(self, move_ids, wizard, journal_ids):
|
def _get_move_lines_order(self, move_ids, wizard, journal_ids):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def _get_move_lines_data(self, ml, wizard, ml_taxes):
|
def _get_move_lines_data(self, ml, wizard, ml_taxes, auto_sequence):
|
||||||
base_debit = (
|
base_debit = (
|
||||||
base_credit
|
base_credit
|
||||||
) = tax_debit = tax_credit = base_balance = tax_balance = 0.0
|
) = tax_debit = tax_credit = base_balance = tax_balance = 0.0
|
||||||
|
@ -116,6 +116,7 @@ class JournalLedgerReport(models.AbstractModel):
|
||||||
"tax_credit": tax_credit,
|
"tax_credit": tax_credit,
|
||||||
"base_balance": base_balance,
|
"base_balance": base_balance,
|
||||||
"tax_balance": tax_balance,
|
"tax_balance": tax_balance,
|
||||||
|
"auto_sequence": str(auto_sequence).zfill(6),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_account_data(self, accounts):
|
def _get_account_data(self, accounts):
|
||||||
|
@ -200,6 +201,7 @@ class JournalLedgerReport(models.AbstractModel):
|
||||||
partners = self.env["res.partner"]
|
partners = self.env["res.partner"]
|
||||||
currencies = self.env["res.currency"]
|
currencies = self.env["res.currency"]
|
||||||
tax_lines = self.env["account.tax"]
|
tax_lines = self.env["account.tax"]
|
||||||
|
auto_sequence = len(move_ids)
|
||||||
for ml in move_lines:
|
for ml in move_lines:
|
||||||
if ml.account_id not in accounts:
|
if ml.account_id not in accounts:
|
||||||
accounts |= ml.account_id
|
accounts |= ml.account_id
|
||||||
|
@ -211,13 +213,14 @@ class JournalLedgerReport(models.AbstractModel):
|
||||||
tax_lines |= ml.tax_line_id
|
tax_lines |= ml.tax_line_id
|
||||||
if ml.move_id.id not in Move_Lines.keys():
|
if ml.move_id.id not in Move_Lines.keys():
|
||||||
Move_Lines[ml.move_id.id] = []
|
Move_Lines[ml.move_id.id] = []
|
||||||
|
auto_sequence -= 1
|
||||||
taxes = (
|
taxes = (
|
||||||
ml.id in move_line_ids_taxes_data.keys()
|
ml.id in move_line_ids_taxes_data.keys()
|
||||||
and move_line_ids_taxes_data[ml.id]
|
and move_line_ids_taxes_data[ml.id]
|
||||||
or {}
|
or {}
|
||||||
)
|
)
|
||||||
Move_Lines[ml.move_id.id].append(
|
Move_Lines[ml.move_id.id].append(
|
||||||
self._get_move_lines_data(ml, wizard, taxes)
|
self._get_move_lines_data(ml, wizard, taxes, auto_sequence)
|
||||||
)
|
)
|
||||||
account_ids_data = self._get_account_data(accounts)
|
account_ids_data = self._get_account_data(accounts)
|
||||||
partner_ids_data = self._get_partner_data(partners)
|
partner_ids_data = self._get_partner_data(partners)
|
||||||
|
@ -348,6 +351,7 @@ class JournalLedgerReport(models.AbstractModel):
|
||||||
"date_from": data["date_from"],
|
"date_from": data["date_from"],
|
||||||
"date_to": data["date_to"],
|
"date_to": data["date_to"],
|
||||||
"move_target": data["move_target"],
|
"move_target": data["move_target"],
|
||||||
|
"with_auto_sequence": data["with_auto_sequence"],
|
||||||
"account_ids_data": account_ids_data,
|
"account_ids_data": account_ids_data,
|
||||||
"partner_ids_data": partner_ids_data,
|
"partner_ids_data": partner_ids_data,
|
||||||
"currency_ids_data": currency_ids_data,
|
"currency_ids_data": currency_ids_data,
|
||||||
|
|
|
@ -28,6 +28,11 @@ class JournalLedgerXslx(models.AbstractModel):
|
||||||
{"header": _("Account"), "field": "account_code", "width": 9},
|
{"header": _("Account"), "field": "account_code", "width": 9},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if report.with_auto_sequence:
|
||||||
|
columns.insert(
|
||||||
|
0, {"header": _("Sequence"), "field": "auto_sequence", "width": 10}
|
||||||
|
)
|
||||||
|
|
||||||
if report.with_account_name:
|
if report.with_account_name:
|
||||||
columns.append(
|
columns.append(
|
||||||
{"header": _("Account Name"), "field": "account_name", "width": 15}
|
{"header": _("Account Name"), "field": "account_name", "width": 15}
|
||||||
|
@ -232,6 +237,7 @@ class JournalLedgerXslx(models.AbstractModel):
|
||||||
line["partner"] = self._get_partner_name(
|
line["partner"] = self._get_partner_name(
|
||||||
line["partner_id"], partner_ids_data
|
line["partner_id"], partner_ids_data
|
||||||
)
|
)
|
||||||
|
line["auto_sequence"] = line["auto_sequence"]
|
||||||
line["account_code"] = account_code
|
line["account_code"] = account_code
|
||||||
line["account_name"] = account_name
|
line["account_name"] = account_name
|
||||||
line["currency_name"] = currency_name
|
line["currency_name"] = currency_name
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
</t>
|
</t>
|
||||||
</template>
|
</template>
|
||||||
<template id="report_journal_ledger_base">
|
<template id="report_journal_ledger_base">
|
||||||
|
<t t-set="with_auto_sequence" t-value="with_auto_sequence" />
|
||||||
<t t-set="display_currency" t-value="foreign_currency" />
|
<t t-set="display_currency" t-value="foreign_currency" />
|
||||||
<t t-set="display_account_name" t-value="with_account_name" />
|
<t t-set="display_account_name" t-value="with_account_name" />
|
||||||
<t t-set="title">
|
<t t-set="title">
|
||||||
|
@ -92,16 +93,44 @@
|
||||||
<template id="account_financial_report.report_journal_ledger_journal_table_header">
|
<template id="account_financial_report.report_journal_ledger_journal_table_header">
|
||||||
<t t-if="not display_account_name">
|
<t t-if="not display_account_name">
|
||||||
<t t-set="account_column_style">width: 8.11%;</t>
|
<t t-set="account_column_style">width: 8.11%;</t>
|
||||||
<t t-set="label_column_style">width: 38.92%;</t>
|
<t t-if="not with_auto_sequence">
|
||||||
|
<t t-set="label_column_style">
|
||||||
|
width: 38.92%;
|
||||||
|
</t>
|
||||||
|
</t>
|
||||||
|
<t t-else="">
|
||||||
|
<t t-set="label_column_style">
|
||||||
|
width: 31.35%;
|
||||||
|
</t>
|
||||||
|
</t>
|
||||||
</t>
|
</t>
|
||||||
<t t-else="">
|
<t t-else="">
|
||||||
<t t-set="account_column_style">width: 23.78%;</t>
|
<t t-if="not with_auto_sequence">
|
||||||
|
<t t-set="account_column_style">
|
||||||
|
width: 23.78%;
|
||||||
|
</t>
|
||||||
|
</t>
|
||||||
|
<t t-else="">
|
||||||
|
<t t-set="account_column_style">
|
||||||
|
width: 16.21%;
|
||||||
|
</t>
|
||||||
|
</t>
|
||||||
<t t-set="label_column_style">width: 23.24%;</t>
|
<t t-set="label_column_style">width: 23.24%;</t>
|
||||||
</t>
|
</t>
|
||||||
<div class="act_as_thead">
|
<div class="act_as_thead">
|
||||||
<div class="act_as_row labels">
|
<div class="act_as_row labels">
|
||||||
|
<t t-if="with_auto_sequence">
|
||||||
|
<div
|
||||||
|
class="act_as_cell first_column"
|
||||||
|
name="entry"
|
||||||
|
style="width: 7.57%;"
|
||||||
|
>
|
||||||
|
Sequence
|
||||||
|
</div>
|
||||||
|
</t>
|
||||||
<div
|
<div
|
||||||
class="act_as_cell first_column"
|
t-att-class="'act_as_cell' if with_auto_sequence else 'act_as_cell first_column'"
|
||||||
|
class="act_as_cell"
|
||||||
name="entry"
|
name="entry"
|
||||||
style="width: 7.57%;"
|
style="width: 7.57%;"
|
||||||
>
|
>
|
||||||
|
@ -143,6 +172,7 @@
|
||||||
</template>
|
</template>
|
||||||
<template id="account_financial_report.report_journal_ledger_journal_first_line">
|
<template id="account_financial_report.report_journal_ledger_journal_first_line">
|
||||||
<div class="act_as_row lines">
|
<div class="act_as_row lines">
|
||||||
|
<div class="act_as_cell" name="Sequence" />
|
||||||
<div class="act_as_cell" name="entry" />
|
<div class="act_as_cell" name="entry" />
|
||||||
<div class="act_as_cell" name="date" />
|
<div class="act_as_cell" name="date" />
|
||||||
<div class="act_as_cell" name="account" />
|
<div class="act_as_cell" name="account" />
|
||||||
|
@ -194,6 +224,9 @@
|
||||||
</t>
|
</t>
|
||||||
</template>
|
</template>
|
||||||
<template id="account_financial_report.report_journal_move_line">
|
<template id="account_financial_report.report_journal_move_line">
|
||||||
|
<div class="act_as_cell left" name="auto_sequence" t-if="with_auto_sequence">
|
||||||
|
<span t-if="display_move_info" t-esc="move_line['auto_sequence']" />
|
||||||
|
</div>
|
||||||
<div class="act_as_cell left" name="entry">
|
<div class="act_as_cell left" name="entry">
|
||||||
<t t-if="display_move_info">
|
<t t-if="display_move_info">
|
||||||
<span
|
<span
|
||||||
|
|
|
@ -40,6 +40,7 @@ class JournalLedgerReportWizard(models.TransientModel):
|
||||||
required=True,
|
required=True,
|
||||||
)
|
)
|
||||||
with_account_name = fields.Boolean(default=False)
|
with_account_name = fields.Boolean(default=False)
|
||||||
|
with_auto_sequence = fields.Boolean(string="Show Auto Sequence", default=False)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_move_targets(self):
|
def _get_move_targets(self):
|
||||||
|
@ -128,6 +129,7 @@ class JournalLedgerReportWizard(models.TransientModel):
|
||||||
"group_option": self.group_option,
|
"group_option": self.group_option,
|
||||||
"with_account_name": self.with_account_name,
|
"with_account_name": self.with_account_name,
|
||||||
"account_financial_report_lang": self.env.lang,
|
"account_financial_report_lang": self.env.lang,
|
||||||
|
"with_auto_sequence": self.with_auto_sequence,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _export(self, report_type):
|
def _export(self, report_type):
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
<field name="group_option" />
|
<field name="group_option" />
|
||||||
<field name="foreign_currency" />
|
<field name="foreign_currency" />
|
||||||
<field name="with_account_name" />
|
<field name="with_account_name" />
|
||||||
|
<field name="with_auto_sequence" />
|
||||||
</group>
|
</group>
|
||||||
<group />
|
<group />
|
||||||
</group>
|
</group>
|
||||||
|
|
Loading…
Reference in New Issue