Skip to content

Commit

Permalink
[MIG] account_move_line_report_xls: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
luc-demeyer committed Sep 16, 2024
1 parent 8d8de06 commit 6200174
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 86 deletions.
15 changes: 10 additions & 5 deletions account_move_line_report_xls/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Account Move Line XLSX export
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--reporting-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-reporting/tree/15.0/account_move_line_report_xls
:target: https://github.com/OCA/account-financial-reporting/tree/16.0/account_move_line_report_xls
:alt: OCA/account-financial-reporting
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-reporting-15-0/account-financial-reporting-15-0-account_move_line_report_xls
:target: https://translation.odoo-community.org/projects/account-financial-reporting-16-0/account-financial-reporting-16-0-account_move_line_report_xls
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-financial-reporting&target_branch=15.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-financial-reporting&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -67,13 +67,18 @@ of the 'account.move.line' object:

Change/extend the Excel template.

Known issues / Roadmap
======================

* Add support for the analytic_distribution field

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-reporting/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-financial-reporting/issues/new?body=module:%20account_move_line_report_xls%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/account-financial-reporting/issues/new?body=module:%20account_move_line_report_xls%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -103,6 +108,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/account-financial-reporting <https://github.com/OCA/account-financial-reporting/tree/15.0/account_move_line_report_xls>`_ project on GitHub.
This module is part of the `OCA/account-financial-reporting <https://github.com/OCA/account-financial-reporting/tree/16.0/account_move_line_report_xls>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion account_move_line_report_xls/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Account Move Line XLSX export",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Noviat, Odoo Community Association (OCA)",
"category": "Accounting & Finance",
Expand Down
1 change: 0 additions & 1 deletion account_move_line_report_xls/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def _report_xlsx_fields(self):
"balance",
"full_reconcile",
"reconcile_amount",
# 'analytic_account_name', 'analytic_account',
# 'ref', 'partner_ref',
# 'amount_residual', 'amount_currency', 'currency_name',
# 'company_currency', 'amount_residual_currency',
Expand Down
1 change: 1 addition & 0 deletions account_move_line_report_xls/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Add support for the analytic_distribution field
94 changes: 32 additions & 62 deletions account_move_line_report_xls/report/account_move_line_xlsx.py
Original file line number Diff line number Diff line change
@@ -1,79 +1,67 @@
# Copyright 2009-2020 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import logging

from odoo import models
from odoo.tools.translate import translate
from odoo import _, models

from odoo.addons.report_xlsx_helper.report.report_xlsx_format import (
FORMATS,
XLS_HEADERS,
)

_logger = logging.getLogger(__name__)

IR_TRANSLATION_NAME = "move.line.list.xls"


class AccountMoveLineXlsx(models.AbstractModel):
_name = "report.account_move_line_report_xls.account_move_line_xlsx"
_inherit = "report.report_xlsx.abstract"
_description = "XLSX report for account move lines."

def _(self, src):
lang = self.env.context.get("lang", "en_US")
val = translate(self.env.cr, IR_TRANSLATION_NAME, "report", lang, src) or src
return val

def _get_ws_params(self, workbook, data, amls):

# XLSX Template
col_specs = {
"move": {
"header": {"value": self._("Entry")},
"header": {"value": _("Entry")},
"lines": {"value": self._render("line.move_id.name")},
"width": 20,
},
"name": {
"header": {"value": self._("Name")},
"header": {"value": _("Name")},
"lines": {"value": self._render("line.name")},
"width": 42,
},
"ref": {
"header": {"value": self._("Reference")},
"header": {"value": _("Reference")},
"lines": {"value": self._render("line.ref")},
"width": 42,
},
"date": {
"header": {"value": self._("Effective Date")},
"header": {"value": _("Effective Date")},
"lines": {
"value": self._render("line.date"),
"format": FORMATS["format_tcell_date_left"],
},
"width": 13,
},
"partner": {
"header": {"value": self._("Partner")},
"header": {"value": _("Partner")},
"lines": {
"value": self._render("line.partner_id and line.partner_id.name")
},
"width": 36,
},
"partner_ref": {
"header": {"value": self._("Partner Reference")},
"header": {"value": _("Partner Reference")},
"lines": {
"value": self._render("line.partner_id and line.partner_id.ref")
},
"width": 36,
},
"account": {
"header": {"value": self._("Account")},
"header": {"value": _("Account")},
"lines": {"value": self._render("line.account_id.code")},
"width": 12,
},
"date_maturity": {
"header": {"value": self._("Maturity Date")},
"header": {"value": _("Maturity Date")},
"lines": {
"value": self._render("line.date_maturity"),
"format": FORMATS["format_tcell_date_left"],
Expand All @@ -82,7 +70,7 @@ def _get_ws_params(self, workbook, data, amls):
},
"debit": {
"header": {
"value": self._("Debit"),
"value": _("Debit"),
"format": FORMATS["format_theader_yellow_right"],
},
"lines": {
Expand All @@ -98,7 +86,7 @@ def _get_ws_params(self, workbook, data, amls):
},
"credit": {
"header": {
"value": self._("Credit"),
"value": _("Credit"),
"format": FORMATS["format_theader_yellow_right"],
},
"lines": {
Expand All @@ -114,7 +102,7 @@ def _get_ws_params(self, workbook, data, amls):
},
"balance": {
"header": {
"value": self._("Balance"),
"value": _("Balance"),
"format": FORMATS["format_theader_yellow_right"],
},
"lines": {
Expand All @@ -130,7 +118,7 @@ def _get_ws_params(self, workbook, data, amls):
},
"full_reconcile": {
"header": {
"value": self._("Rec."),
"value": _("Rec."),
"format": FORMATS["format_theader_yellow_center"],
},
"lines": {
Expand All @@ -142,7 +130,7 @@ def _get_ws_params(self, workbook, data, amls):
"width": 12,
},
"reconcile_amount": {
"header": {"value": self._("Reconcile Amount")},
"header": {"value": _("Reconcile Amount")},
"lines": {
"value": self._render(
"line.full_reconcile_id and line.balance or "
Expand All @@ -154,7 +142,7 @@ def _get_ws_params(self, workbook, data, amls):
"width": 12,
},
"matched_debit_ids": {
"header": {"value": self._("Matched Debits")},
"header": {"value": _("Matched Debits")},
"lines": {
"value": self._render(
"line.matched_debit_ids "
Expand All @@ -165,7 +153,7 @@ def _get_ws_params(self, workbook, data, amls):
"width": 20,
},
"matched_credit_ids": {
"header": {"value": self._("Matched Credits")},
"header": {"value": _("Matched Credits")},
"lines": {
"value": self._render(
"line.matched_credit_ids "
Expand All @@ -177,7 +165,7 @@ def _get_ws_params(self, workbook, data, amls):
},
"amount_currency": {
"header": {
"value": self._("Am. Currency"),
"value": _("Am. Currency"),
"format": FORMATS["format_theader_yellow_right"],
},
"lines": {
Expand All @@ -188,7 +176,7 @@ def _get_ws_params(self, workbook, data, amls):
},
"currency_name": {
"header": {
"value": self._("Curr."),
"value": _("Curr."),
"format": FORMATS["format_theader_yellow_center"],
},
"lines": {
Expand All @@ -198,13 +186,13 @@ def _get_ws_params(self, workbook, data, amls):
"width": 6,
},
"journal": {
"header": {"value": self._("Journal")},
"header": {"value": _("Journal")},
"lines": {"value": self._render("line.journal_id.code")},
"width": 12,
},
"company_currency": {
"header": {
"value": self._("Comp. Curr."),
"value": _("Comp. Curr."),
"format": FORMATS["format_theader_yellow_center"],
},
"lines": {
Expand All @@ -213,33 +201,15 @@ def _get_ws_params(self, workbook, data, amls):
},
"width": 10,
},
"analytic_account": {
"header": {"value": self._("Analytic Account Reference")},
"lines": {
"value": self._render(
"line.analytic_account_id " "and line.analytic_account_id.code"
)
},
"width": 36,
},
"analytic_account_name": {
"header": {"value": self._("Analytic Account")},
"lines": {
"value": self._render(
"line.analytic_account_id " "and line.analytic_account_id.name"
)
},
"width": 36,
},
"product": {
"header": {"value": self._("Product")},
"header": {"value": _("Product")},
"lines": {
"value": self._render("line.product_id and line.product_id.name")
},
"width": 36,
},
"product_ref": {
"header": {"value": self._("Product Reference")},
"header": {"value": _("Product Reference")},
"lines": {
"value": self._render(
"line.product_id and line.product_id.default_code " "or ''"
Expand All @@ -248,7 +218,7 @@ def _get_ws_params(self, workbook, data, amls):
"width": 36,
},
"product_uom": {
"header": {"value": self._("Unit of Measure")},
"header": {"value": _("Unit of Measure")},
"lines": {
"value": self._render(
"line.product_uom_id and line.product_uom_id.name"
Expand All @@ -258,7 +228,7 @@ def _get_ws_params(self, workbook, data, amls):
},
"quantity": {
"header": {
"value": self._("Qty"),
"value": _("Qty"),
"format": FORMATS["format_theader_yellow_right"],
},
"lines": {
Expand All @@ -268,7 +238,7 @@ def _get_ws_params(self, workbook, data, amls):
"width": 8,
},
"statement": {
"header": {"value": self._("Statement")},
"header": {"value": _("Statement")},
"lines": {
"value": self._render(
"line.statement_id and line.statement_id.name"
Expand All @@ -277,13 +247,13 @@ def _get_ws_params(self, workbook, data, amls):
"width": 20,
},
"invoice": {
"header": {"value": self._("Invoice")},
"header": {"value": _("Invoice")},
"lines": {"value": self._render("line.move_id and line.move_id.name")},
"width": 20,
},
"amount_residual": {
"header": {
"value": self._("Residual Amount"),
"value": _("Residual Amount"),
"format": FORMATS["format_theader_yellow_right"],
},
"lines": {
Expand All @@ -294,7 +264,7 @@ def _get_ws_params(self, workbook, data, amls):
},
"amount_residual_currency": {
"header": {
"value": self._("Res. Am. in Curr."),
"value": _("Res. Am. in Curr."),
"format": FORMATS["format_theader_yellow_right"],
},
"lines": {
Expand All @@ -304,13 +274,13 @@ def _get_ws_params(self, workbook, data, amls):
"width": 18,
},
"narration": {
"header": {"value": self._("Notes")},
"header": {"value": _("Notes")},
"lines": {"value": self._render("line.move_id.narration or ''")},
"width": 42,
},
"blocked": {
"header": {
"value": self._("Lit."),
"value": _("Lit."),
"format": FORMATS["format_theader_yellow_center"],
},
"lines": {
Expand All @@ -321,7 +291,7 @@ def _get_ws_params(self, workbook, data, amls):
},
"id": {
"header": {
"value": self._("Id"),
"value": _("Id"),
"format": FORMATS["format_theader_yellow_right"],
},
"lines": {
Expand All @@ -333,7 +303,7 @@ def _get_ws_params(self, workbook, data, amls):
}
col_specs.update(self.env["account.move.line"]._report_xlsx_template())
wanted_list = self.env["account.move.line"]._report_xlsx_fields()
title = self._("Journal Items")
title = _("Journal Items")

return [
{
Expand Down
Loading

0 comments on commit 6200174

Please sign in to comment.