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

[FIX] l10n_it_central_journal_reportlab FIX formatting issues and partner logic #4423

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Changes from all 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
30 changes: 21 additions & 9 deletions l10n_it_central_journal_reportlab/wizard/print_giornale.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,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 @@ -155,7 +155,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 @@ -319,6 +320,12 @@ def get_initial_balance_data_report_giornale(self):
]
return initial_balance_data

def _compute_aml_grouped_name(self, line):
"""
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 All @@ -345,11 +352,12 @@ def get_grupped_final_tables_report_giornale(
continue

start_row += 1
row = Paragraph(escape(str(start_row)), style_name)
date = Paragraph(escape(format_date(self.env, line["date"])), style_name)
move = Paragraph(escape(line["move_name"]), style_name)
account = Paragraph(escape(account_name), style_name)
name = Paragraph(escape(line["name"]), style_name)
row = Paragraph(str(start_row), style_name)
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(self._compute_aml_grouped_name(line), 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 = []
Expand All @@ -359,14 +367,18 @@ def get_grupped_final_tables_report_giornale(
)
credit = Paragraph(escape(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(escape(formatLang(self.env, 0)), style_number)
credit = Paragraph(
escape(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
Loading