Skip to content

Commit

Permalink
[MIG] account_invoice_facturx_py3o to v16
Browse files Browse the repository at this point in the history
  • Loading branch information
alexis-via committed Dec 26, 2022
1 parent 58e0c57 commit 74ac350
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 24 deletions.
6 changes: 3 additions & 3 deletions account_invoice_facturx_py3o/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Copyright 2017-2021 Akretion France (http://www.akretion.com/)
# Copyright 2017-2022 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Py3o Factur-x Invoice",
"version": "14.0.1.0.0",
"version": "16.0.1.0.0",
"category": "Invoicing Management",
"license": "AGPL-3",
"summary": "Generate Factur-X invoices with Py3o reporting engine",
"author": "Akretion,Odoo Community Association (OCA)",
"maintainers": ["alexis-via"],
"website": "https://github.com/OCA/edi",
"depends": ["account_invoice_facturx", "report_py3o"],
"external_dependencies": {"python": ["factur-x"]},
"installable": True,
"auto_install": True,
}
25 changes: 4 additions & 21 deletions account_invoice_facturx_py3o/models/py3o_report.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
# Copyright 2017-2021 Akretion France (http://www.akretion.com/)
# Copyright 2017-2022 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import logging

from odoo import models

logger = logging.getLogger(__name__)

try:
from facturx import generate_facturx_from_file
except ImportError:
logger.debug("Cannot import facturx")


class Py3oReport(models.TransientModel):
_inherit = "py3o.report"
Expand All @@ -28,16 +19,8 @@ def _postprocess_report(self, model_instance, result_path):
and self.ir_actions_report_id.py3o_filetype == "pdf"
and result_path
):
invoice = model_instance
move = model_instance

Check warning on line 22 in account_invoice_facturx_py3o/models/py3o_report.py

View check run for this annotation

Codecov / codecov/patch

account_invoice_facturx_py3o/models/py3o_report.py#L22

Added line #L22 was not covered by tests
# re-write PDF on result_path
if invoice._xml_format_in_pdf_invoice() == "factur-x":
facturx_xml_str, level = invoice.generate_facturx_xml()
pdf_metadata = invoice._prepare_pdf_metadata()
generate_facturx_from_file(
result_path,
facturx_xml_str,
check_xsd=False,
facturx_level=level,
pdf_metadata=pdf_metadata,
)
if move._xml_format_in_pdf_invoice() == "factur-x":
move.regular_pdf_invoice_to_facturx_invoice(result_path)
return super()._postprocess_report(model_instance, result_path)

Check warning on line 26 in account_invoice_facturx_py3o/models/py3o_report.py

View check run for this annotation

Codecov / codecov/patch

account_invoice_facturx_py3o/models/py3o_report.py#L25-L26

Added lines #L25 - L26 were not covered by tests
6 changes: 6 additions & 0 deletions setup/account_invoice_facturx_py3o/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit 74ac350

Please sign in to comment.