Skip to content

Commit

Permalink
[ADD] l10n_it_edi_fatturapa: permit to have preview of e-invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
Borruso committed Apr 26, 2024
1 parent c5a19e5 commit 7bc1ee6
Show file tree
Hide file tree
Showing 15 changed files with 3,877 additions and 0 deletions.
88 changes: 88 additions & 0 deletions l10n_it_edi_fatturapa/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
==================================
Italy - E-invoicing - Base Feature
==================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:aa08d10e7ca0aea140adf8813b97d17f2216c2e96e7fbaf9b074f2b24a6de500
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-italy/tree/master/l10n_it_edi_fatturapa
:alt: OCA/l10n-italy
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-italy-master/l10n-italy-master-l10n_it_edi_fatturapa
: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/l10n-italy&target_branch=master
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

**Italiano**

Questo modulo aggiunge funzionalità basi per gestire le fatture
elettroniche.

<https://www.fatturapa.gov.it>

**English**

This module adds base feature to handle e-invoice.

<https://www.fatturapa.gov.it>

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/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/l10n-italy/issues/new?body=module:%20l10n_it_edi_fatturapa%0Aversion:%20master%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.

Credits
=======

Authors
-------

* Giuseppe Borruso

Contributors
------------

- Giuseppe Borruso - Dinamiche Aziendali srl
<[email protected]>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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/l10n-italy <https://github.com/OCA/l10n-italy/tree/master/l10n_it_edi_fatturapa>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions l10n_it_edi_fatturapa/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2024 Giuseppe Borruso <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import controllers
from . import models
20 changes: 20 additions & 0 deletions l10n_it_edi_fatturapa/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024 Giuseppe Borruso <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Italy - E-invoicing - Base Feature",
"version": "17.3.1.0.0",
"category": "Accounting/Localizations/EDI",
"development_status": "Production/Stable",
"summary": "E-invoice base feature",
"author": "Giuseppe Borruso, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-italy",
"license": "AGPL-3",
"depends": [
"l10n_it_edi",
],
"data": [
"views/l10n_it_view.xml",
],
"installable": True,
}
27 changes: 27 additions & 0 deletions l10n_it_edi_fatturapa/controllers/portal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2024 Giuseppe Borruso <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.http import Controller, request, route


class FatturaPAController(Controller):
@route(
[
"/fatturapa/preview/<attachment_id>",
],
type="http",
auth="user",
website=True,
)
def fatturapa_preview(self, attachment_id, **data):
attach = request.env["ir.attachment"].browse(int(attachment_id))
html = attach.get_fattura_elettronica_preview()
if isinstance(html, bytes):
html = html.decode()
pdf = request.env["ir.actions.report"]._run_wkhtmltopdf([html])

pdfhttpheaders = [
("Content-Type", "application/pdf"),
("Content-Length", len(pdf)),
]
return request.make_response(pdf, headers=pdfhttpheaders)
Loading

0 comments on commit 7bc1ee6

Please sign in to comment.