Skip to content

Commit

Permalink
Merge pull request #1017 from OCA/16.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/account-financial-reporting (16.0)
  • Loading branch information
bt-admin authored Oct 31, 2024
2 parents 54046e4 + 7a752b3 commit bd83462
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Available addons
----------------
addon | version | maintainers | summary
--- | --- | --- | ---
[account_financial_report](account_financial_report/) | 16.0.1.10.1 | | OCA Financial Reports
[account_financial_report](account_financial_report/) | 16.0.1.11.0 | | OCA Financial Reports
[account_financial_report_sale](account_financial_report_sale/) | 16.0.1.0.0 | | OCA Financial Reports Sale
[account_purchase_stock_report_non_billed](account_purchase_stock_report_non_billed/) | 16.0.1.0.0 | [![CarlosRoca13](https://github.com/CarlosRoca13.png?size=30px)](https://github.com/CarlosRoca13) | Account Purchase Stock Report Non Billed
[account_sale_stock_report_non_billed](account_sale_stock_report_non_billed/) | 16.0.1.0.0 | [![CarlosRoca13](https://github.com/CarlosRoca13.png?size=30px)](https://github.com/CarlosRoca13) | Account Sale Stock Report Non Billed
Expand Down
2 changes: 1 addition & 1 deletion account_financial_report/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Account Financial Reports
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ec584b1197021e99e7545e0c2c9406822757867aa4527fe4efe8dfd5f0adc0ab
!! source digest: sha256:f09700927327f126c8625b22440d66ffdf4b57ba05e681e1bc7b07537aa8ff1b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion account_financial_report/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Account Financial Reports",
"version": "16.0.1.10.1",
"version": "16.0.1.11.0",
"category": "Reporting",
"summary": "OCA Financial Reports",
"author": "Camptocamp,"
Expand Down
1 change: 1 addition & 0 deletions account_financial_report/i18n/account_financial_report.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,7 @@ msgstr ""
#: code:addons/account_financial_report/report/open_items_xlsx.py:0
#: code:addons/account_financial_report/report/trial_balance.py:0
#: code:addons/account_financial_report/report/trial_balance.py:0
#: code:addons/account_financial_report/report/trial_balance.py:0
#, python-format
msgid "Missing Partner"
msgstr ""
Expand Down
7 changes: 3 additions & 4 deletions account_financial_report/report/abstract_report_xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def write_ending_balance_from_dict(self, my_object, name, label, report_data):
report_data["formats"]["format_header_amount"],
)
elif cell_type == "amount_currency":
if my_object["currency_id"] and value:
if my_object["currency_id"]:
format_amt = self._get_currency_amt_format_dict(
my_object, report_data
)
Expand Down Expand Up @@ -597,9 +597,8 @@ def _get_currency_amt_header_format_dict(self, line_object, report_data):
{"bold": True, "border": True, "bg_color": "#FFFFCC"}
)
report_data["field_name"] = format_amt
format_amount = "#,##0." + (
"0" * line_object["currency_id"].decimal_places
)
currency = self.env["res.currency"].browse(line_object["currency_id"])
format_amount = "#,##0." + ("0" * currency.decimal_places)
format_amt.set_num_format(format_amount)
return format_amt

Expand Down
18 changes: 14 additions & 4 deletions account_financial_report/report/open_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,18 @@ def _calculate_amounts(self, open_items_move_lines_data):

@api.model
def _order_open_items_by_date(
self, open_items_move_lines_data, show_partner_details, partners_data
self,
open_items_move_lines_data,
show_partner_details,
partners_data,
accounts_data,
):
# We need to order by account code, partner_name and date
accounts_data_sorted = sorted(accounts_data.items(), key=lambda x: x[1]["code"])
account_ids_sorted = [account[0] for account in accounts_data_sorted]
new_open_items = {}
if not show_partner_details:
for acc_id in open_items_move_lines_data.keys():
for acc_id in account_ids_sorted:
new_open_items[acc_id] = {}
move_lines = []
for prt_id in open_items_move_lines_data[acc_id]:
Expand All @@ -219,7 +226,7 @@ def _order_open_items_by_date(
move_lines = sorted(move_lines, key=lambda k: (k["date"]))
new_open_items[acc_id] = move_lines
else:
for acc_id in open_items_move_lines_data.keys():
for acc_id in account_ids_sorted:
new_open_items[acc_id] = {}
for prt_id in sorted(
open_items_move_lines_data[acc_id],
Expand Down Expand Up @@ -265,7 +272,10 @@ def _get_report_values(self, docids, data):

total_amount = self._calculate_amounts(open_items_move_lines_data)
open_items_move_lines_data = self._order_open_items_by_date(
open_items_move_lines_data, show_partner_details, partners_data
open_items_move_lines_data,
show_partner_details,
partners_data,
accounts_data,
)
return {
"doc_ids": [wizard_id],
Expand Down
16 changes: 16 additions & 0 deletions account_financial_report/report/trial_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ def _compute_acc_prt_amount(
total_amount[acc_id][prt_id]["ending_currency_balance"] += round(
tb["amount_currency"], 2
)
total_amount[acc_id][prt_id]["partner_name"] = (
tb["partner_id"][1] if tb["partner_id"] else _("Missing Partner")
)
return total_amount

@api.model
Expand All @@ -293,6 +296,7 @@ def _compute_partner_amount(
total_amount[acc_id][prt_id]["debit"] = tb["debit"]
total_amount[acc_id][prt_id]["balance"] = tb["balance"]
total_amount[acc_id][prt_id]["initial_balance"] = 0.0
total_amount[acc_id][prt_id]["partner_name"] = partners_data[prt_id]["name"]
partners_ids.add(prt_id)
for tb in tb_initial_prt:
acc_id = tb["account_id"][0]
Expand All @@ -305,6 +309,18 @@ def _compute_partner_amount(
total_amount = self._compute_acc_prt_amount(
total_amount, tb, acc_id, prt_id, foreign_currency
)
# sort on partner_name
for acc_id, total_data in total_amount.items():
tmp_list = sorted(
total_data.items(),
key=lambda x: isinstance(x[0], int)
and isinstance(x[1], dict)
and x[1]["partner_name"]
or x[0],
)
total_amount[acc_id] = {}
for key, value in tmp_list:
total_amount[acc_id][key] = value
return total_amount, partners_data

def _remove_accounts_at_cero(self, total_amount, show_partner_details, company):
Expand Down
2 changes: 1 addition & 1 deletion account_financial_report/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Account Financial Reports</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ec584b1197021e99e7545e0c2c9406822757867aa4527fe4efe8dfd5f0adc0ab
!! source digest: sha256:f09700927327f126c8625b22440d66ffdf4b57ba05e681e1bc7b07537aa8ff1b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-financial-reporting/tree/16.0/account_financial_report"><img alt="OCA/account-financial-reporting" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--reporting-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-financial-reporting-16-0/account-financial-reporting-16-0-account_financial_report"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-financial-reporting&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds a set of financial reports. They are accessible under
Expand Down

0 comments on commit bd83462

Please sign in to comment.