Skip to content

Commit

Permalink
[FIX] l10n_be_mis_reports: cut long lines
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Nov 28, 2024
1 parent ac5137b commit 128194b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
8 changes: 6 additions & 2 deletions l10n_be_mis_reports/script/correct_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
},
# Profit & Loss
"pl": {
"rub_9900": "-balp[70%,71%,72%,73%,74%,760%,761%,762%,763%,764%,765%,766%,767%,768%,60%,61%]",
"rub_9900": (
"-balp[70%,71%,72%,73%,74%,"
"760%,761%,762%,763%,764%,765%,766%,767%,768%,60%,61%]"
),
"rub_76A": "-balp[760%,761%,762%,763%,764%,765%,766%,767%,768%]",
"rub_66A": "balp[660%,661%,662%,663%,664%,665%,666%,667%,669%]",
"rub_76B": "-balp[769%]",
Expand Down Expand Up @@ -77,7 +80,8 @@ def correct_xml(xml_template_file):
_add_unallocated_fy_profit(dom, node, xml_template_file)
if "m87" not in xml_template_file.name:
continue
# The expression of this rubric is not present in the m87 calculation JSON file
# The expression of this rubric is not present in the m87
# calculation JSON file
if "rub_130_1" in rubcode:
expression = tuple(
filter(
Expand Down
21 changes: 14 additions & 7 deletions l10n_be_mis_reports/script/generate_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ def _write_report_kpi_records(
:return: the xml document with all his KPI's
"""
odoo = xml_document.documentElement
# sequence starts at 10 and is incremented by 10 each time, following the json layout
# sequence starts at 10 and is incremented by 10 each time, following the
# json layout
sequence = 10
if accounts_dict["section"]["sectionsOrTables"][0].get("section"):
nb_tables = len(accounts_dict["section"]["sectionsOrTables"])
Expand Down Expand Up @@ -301,8 +302,8 @@ def _write_report_kpi_records(
f"{_get_indent(calc_dict, rubcode, 1, rubcode_list)}",
)
record.appendChild(style_id_field)
# Create field 'auto_expand_accounts' and 'auto_expand_accounts_style_id'
# and add as record's child
# Create field 'auto_expand_accounts' and
# 'auto_expand_accounts_style_id' and add as record's child
if _needs_auto_expand(calc) and rubcode != "9900":
auto_expand_field = xml_document.createElement("field")
auto_expand_field.setAttribute("name", "auto_expand_accounts")
Expand Down Expand Up @@ -331,8 +332,10 @@ def _write_report_kpi_records(
def _get_account_label(account_data_list, lang="en"):
"""
This method gets the label of an account
:param account_data_list: a list containing account label and data for period N and N-1
:param lang: (string) language code for the document's language ('de', 'en', 'fr', 'nl')
:param account_data_list: a list containing account label and data for period
N and N-1
:param lang: (string) language code for the document's language
('de', 'en', 'fr', 'nl')
:return: the label of the account
"""
label = ""
Expand Down Expand Up @@ -536,7 +539,10 @@ def _create_rubcode_sequence(
result = ""
nb_of_accounts = len(range(int(first_account), int(last_account) + 1))
if first_account[0] < last_account[0]:
result = f"{first_account}{first_account_letter}%,{last_account}{last_account_letter}%"
result = (
f"{first_account}{first_account_letter}%,"
f"{last_account}{last_account_letter}%"
)
else:
for account_nb in range(int(first_account), int(last_account) + 1):
if str(account_nb) not in rubcode_list:
Expand All @@ -554,7 +560,8 @@ def _create_rubcode_sequence(
def _get_rubcode_list(account_data_list):
"""
This method gets the list of all the rubric codes in accounts_list
:param account_data_list: a list containing account label and data for period N and N-1
:param account_data_list: a list containing account label and data for period
N and N-1
:return: a list containing all account_data_list's rubric codes
"""
rubcodes = []
Expand Down

0 comments on commit 128194b

Please sign in to comment.