Skip to content

Commit

Permalink
[FIX]l10n_it_central_journal_reportlab: formatting and partner logic
Browse files Browse the repository at this point in the history
Fixed grouped formatting (moved values under correct columns, shifted to the right)
Moved content of column "name" under "ref" (as it is the account_move ref)
  • Loading branch information
mymage authored and techgrrow committed Oct 29, 2024
1 parent 28ff929 commit e7a66b8
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions l10n_it_central_journal_reportlab/wizard/print_giornale.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def get_grupped_line_reportlab_ids(self):
am.name AS move_name,
aa.code AS account_code,
aa.name AS account_name,
COALESCE(am.ref, '') AS name,
COALESCE(am.ref, '') AS ref,
SUM(aml.debit) AS debit,
SUM(aml.credit) AS credit
FROM
Expand All @@ -154,7 +154,8 @@ def get_grupped_line_reportlab_ids(self):
ORDER BY
am.date,
am.name,
aa.code
aa.code,
am.ref;
"""
params = {
"date_from": wizard.date_move_line_from,
Expand Down Expand Up @@ -314,6 +315,12 @@ def get_initial_balance_data_report_giornale(self):
]
return initial_balance_data

def _compute_aml_grouped_name(self):
"""
When the account move lines are grouped, the "Name" column is left empty.
This method can be inherited to compute it as desired."""
return ""

def get_grupped_final_tables_report_giornale(
self, list_grupped_line, tables, start_row, width_available
):
Expand Down Expand Up @@ -347,20 +354,25 @@ def get_grupped_final_tables_report_giornale(
date = Paragraph(format_date(self.env, line["date"]), style_name)
move = Paragraph(line["move_name"], style_name)
account = Paragraph(account_name, style_name)
name = Paragraph(line["name"], style_name)
name = Paragraph(self._compute_aml_grouped_name(), style_name)
ref = Paragraph(line["ref"], style_name)
# dato che nel SQL ho la somma dei crediti e debiti potrei avere
# che un conto ha sia debito che credito
lines_data = []
if line["debit"] > 0:
debit = Paragraph(formatLang(self.env, line["debit"]), style_number)
credit = Paragraph(formatLang(self.env, 0), style_number)
list_balance.append((line["debit"], 0))
lines_data.append([[row, date, move, account, name, debit, credit]])
lines_data.append(
[[row, date, ref, move, account, name, debit, credit]]
)
if line["credit"] > 0:
debit = Paragraph(formatLang(self.env, 0), style_number)
credit = Paragraph(formatLang(self.env, line["credit"]), style_number)
list_balance.append((0, line["credit"]))
lines_data.append([[row, date, move, account, name, debit, credit]])
lines_data.append(
[[row, date, ref, move, account, name, debit, credit]]
)
for line_data in lines_data:
if previous_move_name != line["move_name"]:
previous_move_name = line["move_name"]
Expand Down

0 comments on commit e7a66b8

Please sign in to comment.