Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0] Forward port 4 fixes from v14 to v17 #1239

Merged
merged 5 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 @@
{"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)

Check warning on line 601 in account_financial_report/report/abstract_report_xlsx.py

View check run for this annotation

Codecov / codecov/patch

account_financial_report/report/abstract_report_xlsx.py#L600-L601

Added lines #L600 - L601 were not covered by tests
format_amt.set_num_format(format_amount)
return format_amt

Expand Down
13 changes: 13 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,15 @@ 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[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
Loading