From e7a66b8a6a3975291f8858eab95ec483162327df Mon Sep 17 00:00:00 2001 From: mymage Date: Sat, 28 Sep 2024 14:40:23 +0000 Subject: [PATCH] [FIX]l10n_it_central_journal_reportlab: formatting and partner logic 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) --- .../wizard/print_giornale.py | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/l10n_it_central_journal_reportlab/wizard/print_giornale.py b/l10n_it_central_journal_reportlab/wizard/print_giornale.py index 800b9dd8cfc..c6c3149f630 100644 --- a/l10n_it_central_journal_reportlab/wizard/print_giornale.py +++ b/l10n_it_central_journal_reportlab/wizard/print_giornale.py @@ -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 @@ -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, @@ -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 ): @@ -347,7 +354,8 @@ 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 = [] @@ -355,12 +363,16 @@ def get_grupped_final_tables_report_giornale( 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"]