Skip to content

Commit

Permalink
TA#70529 [14.0][ADD] aged_payables_receivables_foreign_currency
Browse files Browse the repository at this point in the history
Clean up
  • Loading branch information
lanto-razafindrabe committed Nov 21, 2024
1 parent 38c1b30 commit f8c51c6
Show file tree
Hide file tree
Showing 13 changed files with 624 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .docker_files/main/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"account_type_archive",
"account_type_sane",
"account_unaffected_earnings_disabled",
"aged_payables_receivables_foreign_currency",
"bank_statement_import_csv",
"bank_statement_extra_columns",
"bank_statement_no_reverse",
Expand All @@ -61,7 +62,7 @@
"old_accounts",
"payment_list_not_sent",
"payment_stripe_not_silenced",
"account_sale_invoice_date_required"
"account_sale_invoice_date_required",
],
"installable": True,
}
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ COPY account_show_full_features /mnt/extra-addons/account_show_full_features
COPY account_type_archive /mnt/extra-addons/account_type_archive
COPY account_type_sane /mnt/extra-addons/account_type_sane
COPY account_unaffected_earnings_disabled /mnt/extra-addons/account_unaffected_earnings_disabled
COPY aged_payables_receivables_foreign_currency /mnt/extra-addons/aged_payables_receivables_foreign_currency
COPY bank_statement_extra_columns /mnt/extra-addons/bank_statement_extra_columns
COPY bank_statement_import_csv /mnt/extra-addons/bank_statement_import_csv
COPY bank_statement_no_reverse /mnt/extra-addons/bank_statement_no_reverse
Expand Down
14 changes: 14 additions & 0 deletions aged_payables_receivables_foreign_currency/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
==========================================
AGED PAYABLES RECEIVABLES FOREIGN CURRENCY
==========================================
This module helps to :
- View and print the aged balance of third parties with the amounts
in foreign currency (according to the currency of the receivable and payable account configured on the partner)
and in the functional currency of the company.
- View partners in alphabetical order

Available in html, pdf and xlsx format.

Contributors
------------
* Numigi (tm) and all its contributors (https://bit.ly/numigiens)
4 changes: 4 additions & 0 deletions aged_payables_receivables_foreign_currency/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import report

Check notice on line 4 in aged_payables_receivables_foreign_currency/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

aged_payables_receivables_foreign_currency/__init__.py#L4

'.report' imported but unused (F401)
18 changes: 18 additions & 0 deletions aged_payables_receivables_foreign_currency/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{

Check warning on line 4 in aged_payables_receivables_foreign_currency/__manifest__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

aged_payables_receivables_foreign_currency/__manifest__.py#L4

Statement seems to have no effect
"name": "Aged Payables and Receivables in Foreign Currency",
"version": "1.0.0",
"author": "Numigi",
"maintainer": "Numigi",
"website": "https://bit.ly/numigi-com",
"license": "AGPL-3",
"category": "project",
"depends": ["account_financial_report"],
"summary": "Shows the original currency on receivable/payable account.",
"data": [
"report/templates/aged_partner_balance.xml",
],
"installable": True,
}
85 changes: 85 additions & 0 deletions aged_payables_receivables_foreign_currency/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * aged_payables_receivables_foreign_currency
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-21 03:09+0000\n"
"PO-Revision-Date: 2024-11-21 03:09+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: aged_payables_receivables_foreign_currency
#: model:ir.model,name:aged_payables_receivables_foreign_currency.model_report_account_financial_report_aged_partner_balance
msgid "Aged Partner Balance Report"
msgstr "Balance âgée des tiers"

#. module: aged_payables_receivables_foreign_currency
#: model:ir.model,name:aged_payables_receivables_foreign_currency.model_report_a_f_r_report_aged_partner_balance_xlsx
msgid "Aged Partner Balance XLSL Report"
msgstr "Balance âgée des tiers XLSX"

#. module: aged_payables_receivables_foreign_currency
#: code:addons/aged_payables_receivables_foreign_currency/report/aged_partner_balance_xlsx.py:0
#: code:addons/aged_payables_receivables_foreign_currency/report/aged_partner_balance_xlsx.py:0
#: model_terms:ir.ui.view,arch_db:aged_payables_receivables_foreign_currency.report_aged_partner_balance_lines_header
#: model_terms:ir.ui.view,arch_db:aged_payables_receivables_foreign_currency.report_aged_partner_balance_move_lines
#, python-format
msgid "Amount Currency"
msgstr "Montant en devise"

#. module: aged_payables_receivables_foreign_currency
#: code:addons/aged_payables_receivables_foreign_currency/report/aged_partner_balance_xlsx.py:0
#: code:addons/aged_payables_receivables_foreign_currency/report/aged_partner_balance_xlsx.py:0
#: model_terms:ir.ui.view,arch_db:aged_payables_receivables_foreign_currency.report_aged_partner_balance_lines_header
#: model_terms:ir.ui.view,arch_db:aged_payables_receivables_foreign_currency.report_aged_partner_balance_move_lines
#, python-format
msgid "Currency"
msgstr "Devise"

#. module: aged_payables_receivables_foreign_currency
#: model:ir.model.fields,field_description:aged_payables_receivables_foreign_currency.field_report_a_f_r_report_aged_partner_balance_xlsx__display_name
#: model:ir.model.fields,field_description:aged_payables_receivables_foreign_currency.field_report_account_financial_report_aged_partner_balance__display_name
msgid "Display Name"
msgstr "Nom affiché"

#. module: aged_payables_receivables_foreign_currency
#: model_terms:ir.ui.view,arch_db:aged_payables_receivables_foreign_currency.report_aged_partner_balance_move_lines
msgid ""
"Due\n"
" date"
msgstr ""
"Échéance\n"
" date"

#. module: aged_payables_receivables_foreign_currency
#: model:ir.model.fields,field_description:aged_payables_receivables_foreign_currency.field_report_a_f_r_report_aged_partner_balance_xlsx__id
#: model:ir.model.fields,field_description:aged_payables_receivables_foreign_currency.field_report_account_financial_report_aged_partner_balance__id
msgid "ID"
msgstr ""

#. module: aged_payables_receivables_foreign_currency
#: model:ir.model.fields,field_description:aged_payables_receivables_foreign_currency.field_report_a_f_r_report_aged_partner_balance_xlsx____last_update
#: model:ir.model.fields,field_description:aged_payables_receivables_foreign_currency.field_report_account_financial_report_aged_partner_balance____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"

#. module: aged_payables_receivables_foreign_currency
#: model_terms:ir.ui.view,arch_db:aged_payables_receivables_foreign_currency.report_aged_partner_balance_lines_header
msgid "Partner"
msgstr "Partenaire"

#. module: aged_payables_receivables_foreign_currency
#: model_terms:ir.ui.view,arch_db:aged_payables_receivables_foreign_currency.report_aged_partner_balance_move_lines
msgid ""
"Ref -\n"
" Label"
msgstr ""
"Ref -\n"
" Libellé"
6 changes: 6 additions & 0 deletions aged_payables_receivables_foreign_currency/report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import abstract_report_xlsx

Check notice on line 4 in aged_payables_receivables_foreign_currency/report/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

aged_payables_receivables_foreign_currency/report/__init__.py#L4

'.abstract_report_xlsx' imported but unused (F401)
from . import aged_partner_balance

Check notice on line 5 in aged_payables_receivables_foreign_currency/report/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

aged_payables_receivables_foreign_currency/report/__init__.py#L5

'.aged_partner_balance' imported but unused (F401)
from . import aged_partner_balance_xlsx

Check notice on line 6 in aged_payables_receivables_foreign_currency/report/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

aged_payables_receivables_foreign_currency/report/__init__.py#L6

'.aged_partner_balance_xlsx' imported but unused (F401)
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.addons.account_financial_report.report.abstract_report_xlsx import (
AbstractReportXslx as AbstractReportXslxOriginal,
)


class AbstractReportXslx(AbstractReportXslxOriginal):
def write_line_from_dict(self, line_dict, report_data):
"""Write a line on current line"""
for col_pos, column in report_data["columns"].items():
value = line_dict.get(column["field"], False)
cell_type = column.get("type", "string")

# If the column is a currency column, we need to get the currency name
if column["field"] == "currency_id":
if isinstance(value, tuple):
value = value[0]
currency = self.env["res.currency"].browse(value).name
line_dict["currency_id"] = value = currency

if cell_type == "string":
if line_dict.get("type", "") == "group_type":
report_data["sheet"].write_string(
report_data["row_pos"],
col_pos,
value or "",
report_data["formats"]["format_bold"],
)
else:
if (
not isinstance(value, str)
and not isinstance(value, bool)
and not isinstance(value, int)
):
value = value and value.strftime("%d/%m/%Y")
report_data["sheet"].write_string(
report_data["row_pos"], col_pos, value or ""
)
elif cell_type == "amount":
if (
line_dict.get("account_group_id", False)
and line_dict["account_group_id"]
):
cell_format = report_data["formats"]["format_amount_bold"]
else:
cell_format = report_data["formats"]["format_amount"]
report_data["sheet"].write_number(
report_data["row_pos"], col_pos, float(value), cell_format
)
elif cell_type == "amount_currency":
if line_dict.get("currency_name", False):
format_amt = self._get_currency_amt_format_dict(
line_dict, report_data
)
report_data["sheet"].write_number(
report_data["row_pos"], col_pos, float(value), format_amt
)
elif cell_type == "currency_name":
report_data["sheet"].write_string(
report_data["row_pos"],
col_pos,
value or "",
report_data["formats"]["format_right"],
)
else:
self.write_non_standard_column(cell_type, col_pos, value)
report_data["row_pos"] += 1

AbstractReportXslxOriginal.write_line_from_dict = write_line_from_dict
Loading

0 comments on commit f8c51c6

Please sign in to comment.