[IMP] account_bank_reconciliation_summary_xlsx: add block to have difference et justification (entered by user)
This commit is contained in:
@@ -6,8 +6,8 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 14.0\n"
|
"Project-Id-Version: Odoo Server 14.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-10-22 10:40+0000\n"
|
"POT-Creation-Date: 2024-10-23 10:04+0000\n"
|
||||||
"PO-Revision-Date: 2024-10-22 10:40+0000\n"
|
"PO-Revision-Date: 2024-10-23 10:04+0000\n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
@@ -17,6 +17,7 @@ msgstr ""
|
|||||||
|
|
||||||
#. module: account_bank_reconciliation_summary_xlsx
|
#. module: account_bank_reconciliation_summary_xlsx
|
||||||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:0
|
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:0
|
||||||
|
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:0
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Amount"
|
msgid "Amount"
|
||||||
msgstr "Montant"
|
msgstr "Montant"
|
||||||
@@ -27,6 +28,12 @@ msgstr "Montant"
|
|||||||
msgid "Balance %s:"
|
msgid "Balance %s:"
|
||||||
msgstr "Solde %s :"
|
msgstr "Solde %s :"
|
||||||
|
|
||||||
|
#. module: account_bank_reconciliation_summary_xlsx
|
||||||
|
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:0
|
||||||
|
#, python-format
|
||||||
|
msgid "Bank Balance:"
|
||||||
|
msgstr "Solde bancaire :"
|
||||||
|
|
||||||
#. module: account_bank_reconciliation_summary_xlsx
|
#. module: account_bank_reconciliation_summary_xlsx
|
||||||
#: model:ir.model.fields,field_description:account_bank_reconciliation_summary_xlsx.field_bank_reconciliation_report_wizard__journal_ids
|
#: model:ir.model.fields,field_description:account_bank_reconciliation_summary_xlsx.field_bank_reconciliation_report_wizard__journal_ids
|
||||||
msgid "Bank Journals"
|
msgid "Bank Journals"
|
||||||
@@ -103,10 +110,23 @@ msgstr "Devise"
|
|||||||
#. module: account_bank_reconciliation_summary_xlsx
|
#. module: account_bank_reconciliation_summary_xlsx
|
||||||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:0
|
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:0
|
||||||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:0
|
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:0
|
||||||
|
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:0
|
||||||
#: model:ir.model.fields,field_description:account_bank_reconciliation_summary_xlsx.field_bank_reconciliation_report_wizard__date
|
#: model:ir.model.fields,field_description:account_bank_reconciliation_summary_xlsx.field_bank_reconciliation_report_wizard__date
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Date"
|
msgid "Date"
|
||||||
msgstr ""
|
msgstr "Date"
|
||||||
|
|
||||||
|
#. module: account_bank_reconciliation_summary_xlsx
|
||||||
|
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:0
|
||||||
|
#, python-format
|
||||||
|
msgid "Description"
|
||||||
|
msgstr "Description"
|
||||||
|
|
||||||
|
#. module: account_bank_reconciliation_summary_xlsx
|
||||||
|
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:0
|
||||||
|
#, python-format
|
||||||
|
msgid "Difference:"
|
||||||
|
msgstr "Écart :"
|
||||||
|
|
||||||
#. module: account_bank_reconciliation_summary_xlsx
|
#. module: account_bank_reconciliation_summary_xlsx
|
||||||
#: model:ir.model.fields,field_description:account_bank_reconciliation_summary_xlsx.field_bank_reconciliation_report_wizard__display_name
|
#: model:ir.model.fields,field_description:account_bank_reconciliation_summary_xlsx.field_bank_reconciliation_report_wizard__display_name
|
||||||
@@ -155,6 +175,12 @@ msgstr ""
|
|||||||
msgid "Journal Entry"
|
msgid "Journal Entry"
|
||||||
msgstr "Pièce"
|
msgstr "Pièce"
|
||||||
|
|
||||||
|
#. module: account_bank_reconciliation_summary_xlsx
|
||||||
|
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:0
|
||||||
|
#, python-format
|
||||||
|
msgid "Justification:"
|
||||||
|
msgstr "Justification :"
|
||||||
|
|
||||||
#. module: account_bank_reconciliation_summary_xlsx
|
#. module: account_bank_reconciliation_summary_xlsx
|
||||||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:0
|
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:0
|
||||||
#, python-format
|
#, python-format
|
||||||
|
|||||||
@@ -65,6 +65,10 @@ class BankReconciliationXlsx(models.AbstractModel):
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
def _write_move_lines_block(self, jdi, row, account, add2total=True):
|
def _write_move_lines_block(self, jdi, row, account, add2total=True):
|
||||||
|
# Returns row
|
||||||
|
# For suspense lines, it may not add any cells if there are no suspense lines
|
||||||
|
# => in this case, it doesn't increment row
|
||||||
|
# If it adds cells, it returns row + 2 to add 2 empty rows at the end
|
||||||
sheet = jdi['sheet']
|
sheet = jdi['sheet']
|
||||||
style = jdi['style']
|
style = jdi['style']
|
||||||
style_suffix = not add2total and '_warn' or ''
|
style_suffix = not add2total and '_warn' or ''
|
||||||
@@ -78,7 +82,7 @@ class BankReconciliationXlsx(models.AbstractModel):
|
|||||||
if add2total:
|
if add2total:
|
||||||
sheet.write(row, 2, _("None"), style['none'])
|
sheet.write(row, 2, _("None"), style['none'])
|
||||||
else:
|
else:
|
||||||
return
|
return row
|
||||||
else:
|
else:
|
||||||
row += 1
|
row += 1
|
||||||
col_labels = [
|
col_labels = [
|
||||||
@@ -112,13 +116,12 @@ class BankReconciliationXlsx(models.AbstractModel):
|
|||||||
sheet.write(row, col, "", style[f"title{style_suffix}"])
|
sheet.write(row, col, "", style[f"title{style_suffix}"])
|
||||||
sheet.write(row, 1, _("Sub-total:") + ' ', style[f"title_right{style_suffix}"])
|
sheet.write(row, 1, _("Sub-total:") + ' ', style[f"title_right{style_suffix}"])
|
||||||
|
|
||||||
formula = '=SUM(%s%d:%s%d)' % (
|
formula = f"=SUM({jdi['total_col']}{start_line}:{jdi['total_col']}{end_line})"
|
||||||
jdi['total_col'], start_line, jdi['total_col'], end_line)
|
|
||||||
sheet.write_formula(row, 2, formula, style[f"{jdi['currency']}_bg{style_suffix}"], subtotal)
|
sheet.write_formula(row, 2, formula, style[f"{jdi['currency']}_bg{style_suffix}"], subtotal)
|
||||||
if add2total:
|
if add2total:
|
||||||
jdi['total'] += subtotal
|
jdi['total'] += subtotal
|
||||||
jdi['total_formula'] += '+%s%d' % (jdi['total_col'], row + 1)
|
jdi['total_formula'] += f"+{jdi['total_col']}{row + 1}"
|
||||||
return row
|
return row + 2
|
||||||
|
|
||||||
def generate_xlsx_report(self, workbook, data, wizard):
|
def generate_xlsx_report(self, workbook, data, wizard):
|
||||||
lang = self.env.user.lang
|
lang = self.env.user.lang
|
||||||
@@ -224,37 +227,74 @@ class BankReconciliationXlsx(models.AbstractModel):
|
|||||||
|
|
||||||
sheet.write(row, 2, account_bal, style[f"{jdi['currency']}_bg"])
|
sheet.write(row, 2, account_bal, style[f"{jdi['currency']}_bg"])
|
||||||
jdi['total'] += account_bal
|
jdi['total'] += account_bal
|
||||||
jdi['total_formula'] += '%s%d' % (jdi['total_col'], row + 1)
|
jdi['total_formula'] += f"{jdi['total_col']}{row + 1}"
|
||||||
|
|
||||||
row += 2
|
row += 2
|
||||||
# 2) Show payment lines IN (debit)
|
# 2) Show payment lines IN (debit)
|
||||||
debit_account = journal.payment_debit_account_id
|
debit_account = journal.payment_debit_account_id
|
||||||
row = self._write_move_lines_block(jdi, row, debit_account)
|
row = self._write_move_lines_block(jdi, row, debit_account)
|
||||||
row += 2
|
|
||||||
# 3) Show payment lines OUT (credit)
|
# 3) Show payment lines OUT (credit)
|
||||||
credit_account = journal.payment_credit_account_id
|
credit_account = journal.payment_credit_account_id
|
||||||
row = self._write_move_lines_block(jdi, row, credit_account)
|
row = self._write_move_lines_block(jdi, row, credit_account)
|
||||||
row += 2
|
|
||||||
|
|
||||||
for col in range(1):
|
for col in range(1):
|
||||||
sheet.write(row, col, "", style['title'])
|
sheet.write(row, col, "", style['title'])
|
||||||
sheet.write(row, 1, _("TOTAL:") + ' ', style['title_right'])
|
sheet.write(row, 1, _("TOTAL:") + ' ', style['title_right'])
|
||||||
sheet.write_formula(
|
sheet.write_formula(
|
||||||
row, 2, jdi['total_formula'], style[f"{jdi['currency']}_bg"], jdi['total'])
|
row, 2, jdi['total_formula'], style[f"{jdi['currency']}_bg"], jdi['total'])
|
||||||
row += 3
|
total_row = row
|
||||||
|
row += 2
|
||||||
|
|
||||||
# 4) Show suspense account lines
|
# 4) Show suspense account lines
|
||||||
row = self._write_move_lines_block(
|
row = self._write_move_lines_block(
|
||||||
jdi, row, journal.suspense_account_id, add2total=False)
|
jdi, row, journal.suspense_account_id, add2total=False)
|
||||||
|
|
||||||
|
# Static cells
|
||||||
|
for col in range(1):
|
||||||
|
sheet.write(row, col, "", style['title'])
|
||||||
|
sheet.write(row, 1, _("Bank Balance:") + ' ', style['title_right'])
|
||||||
|
sheet.write(row, 2, 0, style[f"{jdi['currency']}_bg_manual"])
|
||||||
|
bank_bal_row = row
|
||||||
|
row += 2
|
||||||
|
for col in range(1):
|
||||||
|
sheet.write(row, col, "", style['title'])
|
||||||
|
sheet.write(row, 1, _("Difference:") + ' ', style['title_right'])
|
||||||
|
sheet.write_formula(
|
||||||
|
row, 2, f"={jdi['total_col']}{total_row + 1}-{jdi['total_col']}{bank_bal_row + 1}",
|
||||||
|
style[f"{jdi['currency']}_bg"], jdi['total'])
|
||||||
|
row += 2
|
||||||
|
for col in range(1):
|
||||||
|
sheet.write(row, col, "", style['title'])
|
||||||
|
sheet.write(row, 1, _("Justification:") + ' ', style['title_right'])
|
||||||
|
justif_lines = 6
|
||||||
|
sheet.write_formula(
|
||||||
|
row, 2, f"=SUM({jdi['total_col']}{row+3}:{jdi['total_col']}{row+3+justif_lines-1})",
|
||||||
|
style[f"{jdi['currency']}_bg"], 0)
|
||||||
|
row += 1
|
||||||
|
col_labels = [
|
||||||
|
_("Date"),
|
||||||
|
_("Description"),
|
||||||
|
_("Amount"),
|
||||||
|
]
|
||||||
|
col = 0
|
||||||
|
for col_label in col_labels:
|
||||||
|
sheet.write(row, col, col_label, style['col_header'])
|
||||||
|
col += 1
|
||||||
|
for x in range(justif_lines):
|
||||||
|
row += 1
|
||||||
|
sheet.write(row, 0, "", style['regular_date'])
|
||||||
|
sheet.write(row, 1, "", style['regular'])
|
||||||
|
sheet.write(row, 2, "", style[jdi['currency']])
|
||||||
|
|
||||||
def _get_style(self, workbook, company):
|
def _get_style(self, workbook, company):
|
||||||
style = {}
|
style = {}
|
||||||
font_size = 10
|
font_size = 10
|
||||||
light_grey = "#eeeeee"
|
light_grey = "#eeeeee"
|
||||||
light_blue = "#e0edff"
|
light_blue = "#e0edff"
|
||||||
subtotal_orange = "#ffcc00"
|
subtotal_orange = "#ffcc00"
|
||||||
title_warn = "#ff9999"
|
|
||||||
subtotal_warn = "#ffff99"
|
subtotal_warn = "#ffff99"
|
||||||
|
amount_manual = "#ffeeab"
|
||||||
|
title_warn = "#ff9999"
|
||||||
lang_code = self.env.user.lang
|
lang_code = self.env.user.lang
|
||||||
lang = False
|
lang = False
|
||||||
if lang_code:
|
if lang_code:
|
||||||
@@ -307,12 +347,12 @@ class BankReconciliationXlsx(models.AbstractModel):
|
|||||||
dict(title_style, align="left", bg_color=title_warn))
|
dict(title_style, align="left", bg_color=title_warn))
|
||||||
style['title_right_warn'] = workbook.add_format(
|
style['title_right_warn'] = workbook.add_format(
|
||||||
dict(title_style, align="right", bg_color=title_warn))
|
dict(title_style, align="right", bg_color=title_warn))
|
||||||
style['regular'] = workbook.add_format({"font_size": font_size})
|
style['regular'] = workbook.add_format({"font_size": font_size, "border": 1})
|
||||||
if "%" in xls_date_format:
|
if "%" in xls_date_format:
|
||||||
# fallback
|
# fallback
|
||||||
xls_date_format = "yyyy-mm-dd"
|
xls_date_format = "yyyy-mm-dd"
|
||||||
style['regular_date'] = workbook.add_format(
|
style['regular_date'] = workbook.add_format(
|
||||||
{"num_format": xls_date_format, "font_size": font_size, "align": "left"}
|
{"num_format": xls_date_format, "font_size": font_size, "align": "left", "border": 1}
|
||||||
)
|
)
|
||||||
for currency in self.env['res.currency'].search([]):
|
for currency in self.env['res.currency'].search([]):
|
||||||
symbol = currency.symbol or currency.name
|
symbol = currency.symbol or currency.name
|
||||||
@@ -325,9 +365,11 @@ class BankReconciliationXlsx(models.AbstractModel):
|
|||||||
# and thousand separator by those of the language under which
|
# and thousand separator by those of the language under which
|
||||||
# Excel runs
|
# Excel runs
|
||||||
currency_style = {"num_format": cur_format, "font_size": font_size}
|
currency_style = {"num_format": cur_format, "font_size": font_size}
|
||||||
style[currency] = workbook.add_format(currency_style)
|
style[currency] = workbook.add_format(dict(currency_style, border=1))
|
||||||
style[f'{currency}_bg'] = workbook.add_format(
|
style[f'{currency}_bg'] = workbook.add_format(
|
||||||
dict(currency_style, bg_color=subtotal_orange))
|
dict(currency_style, bg_color=subtotal_orange))
|
||||||
style[f'{currency}_bg_warn'] = workbook.add_format(
|
style[f'{currency}_bg_warn'] = workbook.add_format(
|
||||||
dict(currency_style, bg_color=subtotal_warn))
|
dict(currency_style, bg_color=subtotal_warn))
|
||||||
|
style[f'{currency}_bg_manual'] = workbook.add_format(
|
||||||
|
dict(currency_style, bg_color=amount_manual))
|
||||||
return style
|
return style
|
||||||
|
|||||||
Reference in New Issue
Block a user