Browse Source

[MIG] account_move_line_report_xls: Migration to 14.0

pull/789/head
Pieter Paulussen 4 years ago
committed by Pieter Paulussen
parent
commit
0bdfebdb90
  1. 2
      account_move_line_report_xls/__manifest__.py
  2. 75
      account_move_line_report_xls/report/account_move_line_xlsx.py
  3. 2
      account_move_line_report_xls/tests/test_aml_report_xlsx.py

2
account_move_line_report_xls/__manifest__.py

@ -3,7 +3,7 @@
{ {
"name": "Account Move Line XLSX export", "name": "Account Move Line XLSX export",
"version": "13.0.1.0.0",
"version": "14.0.1.0.0",
"license": "AGPL-3", "license": "AGPL-3",
"author": "Noviat, Odoo Community Association (OCA)", "author": "Noviat, Odoo Community Association (OCA)",
"category": "Accounting & Finance", "category": "Accounting & Finance",

75
account_move_line_report_xls/report/account_move_line_xlsx.py

@ -6,6 +6,11 @@ import logging
from odoo import models from odoo import models
from odoo.tools.translate import translate from odoo.tools.translate import translate
from odoo.addons.report_xlsx_helper.report.report_xlsx_format import (
FORMATS,
XLS_HEADERS,
)
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
IR_TRANSLATION_NAME = "move.line.list.xls" IR_TRANSLATION_NAME = "move.line.list.xls"
@ -43,7 +48,7 @@ class AccountMoveLineXlsx(models.AbstractModel):
"header": {"value": self._("Effective Date")}, "header": {"value": self._("Effective Date")},
"lines": { "lines": {
"value": self._render("line.date"), "value": self._render("line.date"),
"format": self.format_tcell_date_left,
"format": FORMATS["format_tcell_date_left"],
}, },
"width": 13, "width": 13,
}, },
@ -70,68 +75,68 @@ class AccountMoveLineXlsx(models.AbstractModel):
"header": {"value": self._("Maturity Date")}, "header": {"value": self._("Maturity Date")},
"lines": { "lines": {
"value": self._render("line.date_maturity"), "value": self._render("line.date_maturity"),
"format": self.format_tcell_date_left,
"format": FORMATS["format_tcell_date_left"],
}, },
"width": 13, "width": 13,
}, },
"debit": { "debit": {
"header": { "header": {
"value": self._("Debit"), "value": self._("Debit"),
"format": self.format_theader_yellow_right,
"format": FORMATS["format_theader_yellow_right"],
}, },
"lines": { "lines": {
"value": self._render("line.debit"), "value": self._render("line.debit"),
"format": self.format_tcell_amount_right,
"format": FORMATS["format_tcell_amount_right"],
}, },
"totals": { "totals": {
"type": "formula", "type": "formula",
"value": self._render("debit_formula"), "value": self._render("debit_formula"),
"format": self.format_theader_yellow_amount_right,
"format": FORMATS["format_theader_yellow_amount_right"],
}, },
"width": 18, "width": 18,
}, },
"credit": { "credit": {
"header": { "header": {
"value": self._("Credit"), "value": self._("Credit"),
"format": self.format_theader_yellow_right,
"format": FORMATS["format_theader_yellow_right"],
}, },
"lines": { "lines": {
"value": self._render("line.credit"), "value": self._render("line.credit"),
"format": self.format_tcell_amount_right,
"format": FORMATS["format_tcell_amount_right"],
}, },
"totals": { "totals": {
"type": "formula", "type": "formula",
"value": self._render("credit_formula"), "value": self._render("credit_formula"),
"format": self.format_theader_yellow_amount_right,
"format": FORMATS["format_theader_yellow_amount_right"],
}, },
"width": 18, "width": 18,
}, },
"balance": { "balance": {
"header": { "header": {
"value": self._("Balance"), "value": self._("Balance"),
"format": self.format_theader_yellow_right,
"format": FORMATS["format_theader_yellow_right"],
}, },
"lines": { "lines": {
"value": self._render("line.balance"), "value": self._render("line.balance"),
"format": self.format_tcell_amount_right,
"format": FORMATS["format_tcell_amount_right"],
}, },
"totals": { "totals": {
"type": "formula", "type": "formula",
"value": self._render("bal_formula"), "value": self._render("bal_formula"),
"format": self.format_theader_yellow_amount_right,
"format": FORMATS["format_theader_yellow_amount_right"],
}, },
"width": 18, "width": 18,
}, },
"full_reconcile": { "full_reconcile": {
"header": { "header": {
"value": self._("Rec."), "value": self._("Rec."),
"format": self.format_theader_yellow_center,
"format": FORMATS["format_theader_yellow_center"],
}, },
"lines": { "lines": {
"value": self._render( "value": self._render(
"line.full_reconcile_id " "and line.full_reconcile_id.name" "line.full_reconcile_id " "and line.full_reconcile_id.name"
), ),
"format": self.format_tcell_center,
"format": FORMATS["format_tcell_center"],
}, },
"width": 12, "width": 12,
}, },
@ -143,7 +148,7 @@ class AccountMoveLineXlsx(models.AbstractModel):
"(sum(line.matched_credit_ids.mapped('amount')) - " "(sum(line.matched_credit_ids.mapped('amount')) - "
"sum(line.matched_debit_ids.mapped('amount')))" "sum(line.matched_debit_ids.mapped('amount')))"
), ),
"format": self.format_tcell_amount_right,
"format": FORMATS["format_tcell_amount_right"],
}, },
"width": 12, "width": 12,
}, },
@ -172,22 +177,22 @@ class AccountMoveLineXlsx(models.AbstractModel):
"amount_currency": { "amount_currency": {
"header": { "header": {
"value": self._("Am. Currency"), "value": self._("Am. Currency"),
"format": self.format_theader_yellow_right,
"format": FORMATS["format_theader_yellow_right"],
}, },
"lines": { "lines": {
"value": self._render("line.amount_currency"), "value": self._render("line.amount_currency"),
"format": self.format_tcell_amount_right,
"format": FORMATS["format_tcell_amount_right"],
}, },
"width": 18, "width": 18,
}, },
"currency_name": { "currency_name": {
"header": { "header": {
"value": self._("Curr."), "value": self._("Curr."),
"format": self.format_theader_yellow_center,
"format": FORMATS["format_theader_yellow_center"],
}, },
"lines": { "lines": {
"value": self._render("line.currency_id and line.currency_id.name"), "value": self._render("line.currency_id and line.currency_id.name"),
"format": self.format_tcell_center,
"format": FORMATS["format_tcell_center"],
}, },
"width": 6, "width": 6,
}, },
@ -199,11 +204,11 @@ class AccountMoveLineXlsx(models.AbstractModel):
"company_currency": { "company_currency": {
"header": { "header": {
"value": self._("Comp. Curr."), "value": self._("Comp. Curr."),
"format": self.format_theader_yellow_center,
"format": FORMATS["format_theader_yellow_center"],
}, },
"lines": { "lines": {
"value": self._render("line.company_id.currency_id.name"), "value": self._render("line.company_id.currency_id.name"),
"format": self.format_tcell_center,
"format": FORMATS["format_tcell_center"],
}, },
"width": 10, "width": 10,
}, },
@ -253,11 +258,11 @@ class AccountMoveLineXlsx(models.AbstractModel):
"quantity": { "quantity": {
"header": { "header": {
"value": self._("Qty"), "value": self._("Qty"),
"format": self.format_theader_yellow_right,
"format": FORMATS["format_theader_yellow_right"],
}, },
"lines": { "lines": {
"value": self._render("line.quantity"), "value": self._render("line.quantity"),
"format": self.format_tcell_amount_right,
"format": FORMATS["format_tcell_amount_right"],
}, },
"width": 8, "width": 8,
}, },
@ -280,22 +285,22 @@ class AccountMoveLineXlsx(models.AbstractModel):
"amount_residual": { "amount_residual": {
"header": { "header": {
"value": self._("Residual Amount"), "value": self._("Residual Amount"),
"format": self.format_theader_yellow_right,
"format": FORMATS["format_theader_yellow_right"],
}, },
"lines": { "lines": {
"value": self._render("line.amount_residual"), "value": self._render("line.amount_residual"),
"format": self.format_tcell_amount_right,
"format": FORMATS["format_tcell_amount_right"],
}, },
"width": 18, "width": 18,
}, },
"amount_residual_currency": { "amount_residual_currency": {
"header": { "header": {
"value": self._("Res. Am. in Curr."), "value": self._("Res. Am. in Curr."),
"format": self.format_theader_yellow_right,
"format": FORMATS["format_theader_yellow_right"],
}, },
"lines": { "lines": {
"value": self._render("line.amount_residual_currency"), "value": self._render("line.amount_residual_currency"),
"format": self.format_tcell_amount_right,
"format": FORMATS["format_tcell_amount_right"],
}, },
"width": 18, "width": 18,
}, },
@ -307,22 +312,22 @@ class AccountMoveLineXlsx(models.AbstractModel):
"blocked": { "blocked": {
"header": { "header": {
"value": self._("Lit."), "value": self._("Lit."),
"format": self.format_theader_yellow_center,
"format": FORMATS["format_theader_yellow_center"],
}, },
"lines": { "lines": {
"value": self._render("line.blocked and 'x' or ''"), "value": self._render("line.blocked and 'x' or ''"),
"format": self.format_tcell_center,
"format": FORMATS["format_tcell_center"],
}, },
"width": 4, "width": 4,
}, },
"id": { "id": {
"header": { "header": {
"value": self._("Id"), "value": self._("Id"),
"format": self.format_theader_yellow_right,
"format": FORMATS["format_theader_yellow_right"],
}, },
"lines": { "lines": {
"value": self._render("line.id"), "value": self._render("line.id"),
"format": self.format_tcell_integer_right,
"format": FORMATS["format_tcell_integer_right"],
}, },
"width": 12, "width": 12,
}, },
@ -345,8 +350,8 @@ class AccountMoveLineXlsx(models.AbstractModel):
ws.set_landscape() ws.set_landscape()
ws.fit_to_pages(1, 0) ws.fit_to_pages(1, 0)
ws.set_header(self.xls_headers["standard"])
ws.set_footer(self.xls_footers["standard"])
ws.set_header(XLS_HEADERS["xls_headers"]["standard"])
ws.set_footer(XLS_HEADERS["xls_footers"]["standard"])
self._set_column_width(ws, ws_params) self._set_column_width(ws, ws_params)
@ -358,7 +363,7 @@ class AccountMoveLineXlsx(models.AbstractModel):
row_pos, row_pos,
ws_params, ws_params,
col_specs_section="header", col_specs_section="header",
default_format=self.format_theader_yellow_left,
default_format=FORMATS["format_theader_yellow_left"],
) )
ws.freeze_panes(row_pos, 0) ws.freeze_panes(row_pos, 0)
@ -374,7 +379,7 @@ class AccountMoveLineXlsx(models.AbstractModel):
ws_params, ws_params,
col_specs_section="lines", col_specs_section="lines",
render_space={"line": line}, render_space={"line": line},
default_format=self.format_tcell_left,
default_format=FORMATS["format_tcell_left"],
) )
aml_cnt = len(amls) aml_cnt = len(amls)
@ -397,5 +402,5 @@ class AccountMoveLineXlsx(models.AbstractModel):
"credit_formula": credit_formula, "credit_formula": credit_formula,
"bal_formula": bal_formula, "bal_formula": bal_formula,
}, },
default_format=self.format_theader_yellow_left,
default_format=FORMATS["format_theader_yellow_left"],
) )

2
account_move_line_report_xls/tests/test_aml_report_xlsx.py

@ -28,5 +28,5 @@ class TestAmlReportXlsx(TransactionCase):
self.amls = am.line_ids self.amls = am.line_ids
def test_aml_report_xlsx(self): def test_aml_report_xlsx(self):
report_xls = self.report.render_xlsx(self.amls.ids, None)
report_xls = self.report._render_xlsx(self.amls.ids, None)
self.assertEqual(report_xls[1], "xlsx") self.assertEqual(report_xls[1], "xlsx")
Loading…
Cancel
Save