Skip to content

Commit

Permalink
Add currency column to general_ledger/trial_balance_xlsx excel export…
Browse files Browse the repository at this point in the history
… file
  • Loading branch information
RaoufJabriCamptocamp committed Jan 23, 2024
1 parent 6687c0b commit c2a248b
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 8 deletions.
10 changes: 10 additions & 0 deletions account_financial_report/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,10 @@ msgstr "Cumul bal."

#. module: account_financial_report
#. odoo-python
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:0
#: code:addons/account_financial_report/report/open_items_xlsx.py:0
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:0
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:0
#: model_terms:ir.ui.view,arch_db:account_financial_report.report_journal_ledger_journal_table_header
#: model_terms:ir.ui.view,arch_db:account_financial_report.report_open_items_lines_header
#, python-format
Expand Down Expand Up @@ -1467,6 +1470,13 @@ msgstr "Afficher le détail des écritures"
msgid "Show Partner Details"
msgstr "Afficher le détail du partenaire"

#. module: account_financial_report
#: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__show_currency_name
#: model:ir.model.fields,field_description:account_financial_report.field_open_items_report_wizard__show_currency_name
#: model:ir.model.fields,field_description:account_financial_report.field_trial_balance_report_wizard__show_currency_name
msgid "Show currency name"
msgstr "Afficher le nom de la devise"

#. module: account_financial_report
#. odoo-python
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:0
Expand Down
10 changes: 10 additions & 0 deletions account_financial_report/report/general_ledger_xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ def _get_report_columns(self, report):
"width": 14,
},
]
if report.foreign_currency and report.show_currency_name:
res += [
{
"header": _("Cur."),
"field": "currency_name",
"field_currency_balance": "currency_name",
"type": "currency_name",
"width": 7,
},
]
if report.foreign_currency:
res += [
{
Expand Down
33 changes: 25 additions & 8 deletions account_financial_report/report/open_items_xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,44 @@ def _get_report_columns(self, report):
if report.foreign_currency:
foreign_currency = {
9: {
"header": _("Cur."),
"field": "currency_name",
"field_currency_balance": "currency_name",
"type": "currency_name",
"width": 7,
},
10: {
"header": _("Cur. Original"),
"field": "amount_currency",
"field_final_balance": "amount_currency",
"type": "amount_currency",
"width": 14,
},
11: {
10: {
"header": _("Cur. Residual"),
"field": "amount_residual_currency",
"field_final_balance": "amount_currency",
"type": "amount_currency",
"width": 14,
},
}
if report.show_currency_name:
foreign_currency = {
9: {
"header": _("Cur."),
"field": "currency_name",
"field_currency_balance": "currency_name",
"type": "currency_name",
"width": 7,
},
10: {
"header": _("Cur. Original"),
"field": "amount_currency",
"field_final_balance": "amount_currency",
"type": "amount_currency",
"width": 14,
},
11: {
"header": _("Cur. Residual"),
"field": "amount_residual_currency",
"field_final_balance": "amount_currency",
"type": "amount_currency",
"width": 14,
},
}
res = {**res, **foreign_currency}
return res

Expand Down
44 changes: 44 additions & 0 deletions account_financial_report/report/trial_balance_xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,28 @@ def _get_report_columns(self, report):
"width": 14,
},
}
if report.show_currency_name:
foreign_currency = {
7: {
"header": _("Cur."),
"field": "currency_name",
"field_currency_balance": "currency_name",
"type": "currency_name",
"width": 7,
},
8: {
"header": _("Initial balance"),
"field": "initial_currency_balance",
"type": "amount_currency",
"width": 14,
},
9: {
"header": _("Ending balance"),
"field": "ending_currency_balance",
"type": "amount_currency",
"width": 14,
},
}
res = {**res, **foreign_currency}
return res
else:
Expand Down Expand Up @@ -123,6 +145,28 @@ def _get_report_columns(self, report):
"width": 14,
},
}
if report.show_currency_name:
foreign_currency = {
6: {
"header": _("Cur."),
"field": "currency_name",
"field_currency_balance": "currency_name",
"type": "currency_name",
"width": 7,
},
7: {
"header": _("Initial balance"),
"field": "initial_currency_balance",
"type": "amount_currency",
"width": 14,
},
9: {
"header": _("Ending balance"),
"field": "ending_currency_balance",
"type": "amount_currency",
"width": 14,
},
}
res = {**res, **foreign_currency}
return res

Expand Down
4 changes: 4 additions & 0 deletions account_financial_report/wizard/general_ledger_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ class GeneralLedgerReportWizard(models.TransientModel):
"will display initial and final balance in that currency.",
default=lambda self: self._default_foreign_currency(),
)
show_currency_name = fields.Boolean(
string="Show currency name",
help="Display foreign currency name for move lines",
)
account_code_from = fields.Many2one(
comodel_name="account.account",
help="Starting account in a range",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
<field name="centralize" />
<field name="hide_account_at_0" />
<field name="foreign_currency" />
<field
name="show_currency_name"
attrs="{'invisible': [('foreign_currency', '=', False)]}"
/>
<field name="show_cost_center" />
</group>
</group>
Expand Down
4 changes: 4 additions & 0 deletions account_financial_report/wizard/open_items_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class OpenItemsReportWizard(models.TransientModel):
"will display initial and final balance in that currency.",
default=lambda self: self._default_foreign_currency(),
)
show_currency_name = fields.Boolean(
string="Show currency name",
help="Display foreign currency name for move lines",
)
show_partner_details = fields.Boolean(
default=True,
)
Expand Down
4 changes: 4 additions & 0 deletions account_financial_report/wizard/open_items_wizard_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
<field name="show_partner_details" />
<field name="hide_account_at_0" />
<field name="foreign_currency" />
<field
name="show_currency_name"
attrs="{'invisible': [('foreign_currency', '=', False)]}"
/>
</group>
</group>
<group name="partner_filter" col="1">
Expand Down
4 changes: 4 additions & 0 deletions account_financial_report/wizard/trial_balance_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class TrialBalanceReportWizard(models.TransientModel):
"account currency is not setup through chart of accounts "
"will display initial and final balance in that currency.",
)
show_currency_name = fields.Boolean(
string="Show currency name",
help="Display foreign currency name for move lines",
)
account_code_from = fields.Many2one(
comodel_name="account.account",
help="Starting account in a range",
Expand Down
4 changes: 4 additions & 0 deletions account_financial_report/wizard/trial_balance_wizard_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
attrs="{'invisible':[('limit_hierarchy_level','=', False)]}"
/>
<field name="foreign_currency" />
<field
name="show_currency_name"
attrs="{'invisible': [('foreign_currency', '=', False)]}"
/>
</group>
</group>
<group
Expand Down

0 comments on commit c2a248b

Please sign in to comment.