Skip to content

Commit

Permalink
ADD l10n_it_fatturapa_out_ddt
Browse files Browse the repository at this point in the history
IMP PEP8
  • Loading branch information
eLBati committed Oct 7, 2018
1 parent 7fc6f0a commit 5ee52c2
Show file tree
Hide file tree
Showing 24 changed files with 653 additions and 23 deletions.
9 changes: 1 addition & 8 deletions l10n_it_fatturapa/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

class FatturaElettronicaController(Controller):

#------------------------------------------------------
# Report controllers
#------------------------------------------------------
@route([
'/fatturapa/preview/<attachment_id>',
], type='http', auth='user', website=True)
Expand All @@ -17,10 +14,6 @@ def pdf_preview(self, attachment_id, **data):
pdf = request.env['report']._run_wkhtmltopdf(
[], [], [[False, html]], None, None)
pdfhttpheaders = [
('Content-Type', 'application/pdf'), ('Content-Length', len(pdf)),
# (
# 'Content-Disposition', 'attachment; '
# 'filename="fatturaelettronica%s.pdf"' % attachment_id
# ),
('Content-Type', 'application/pdf'), ('Content-Length', len(pdf))
]
return request.make_response(pdf, headers=pdfhttpheaders)
3 changes: 2 additions & 1 deletion l10n_it_fatturapa/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class FatturapaPaymentDetail(models.Model):
_name = "fatturapa.payment.detail"
recipient = fields.Char('Recipient', size=200)
fatturapa_pm_id = fields.Many2one(
'fatturapa.payment_method', string="Fattura Elettronica Payment Method")
'fatturapa.payment_method', string="Fattura Elettronica Payment Method"
)
payment_term_start = fields.Date('Payment Term Start')
payment_days = fields.Integer('Payment Term Days')
payment_due_date = fields.Date('Payment due Date')
Expand Down
2 changes: 1 addition & 1 deletion l10n_it_fatturapa/models/partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ def _check_codice_destinatario(self):
raise ValidationError(_(
"Il partner %s, con Codice Destinatario '0000000',"
" deve avere o P.IVA o codice fiscale"
) % partner.name)
) % partner.name)
5 changes: 3 additions & 2 deletions l10n_it_fatturapa_in/models/account.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

from odoo import fields, models, api, _
from odoo import fields, models, api


class AccountInvoice(models.Model):
Expand Down Expand Up @@ -35,6 +35,7 @@ def remove_attachment_link(self):
self.fatturapa_attachment_in_id = False
return {'type': 'ir.actions.client', 'tag': 'reload'}


class fatturapa_article_code(models.Model):
# _position = ['2.2.1.3']
_name = "fatturapa.article.code"
Expand Down Expand Up @@ -105,4 +106,4 @@ class EInvoiceLineOtherData(models.Model):
name = fields.Char("Tipo Dato", readonly=True)
text_ref = fields.Char("Riferimento Testo", readonly=True)
num_ref = fields.Float("Riferimento Numero", readonly=True)
date_ref = fields.Char("Riferimento Data", readonly=True)
date_ref = fields.Char("Riferimento Data", readonly=True)
11 changes: 6 additions & 5 deletions l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def test_00_xml_import(self):
self.assertEqual(line.price_unit, 3)
welfare_found = True
self.assertTrue(welfare_found)
self.assertTrue(len(invoice.e_invoice_line_ids)==1)
self.assertTrue(len(invoice.e_invoice_line_ids) == 1)
self.assertEqual(
invoice.e_invoice_line_ids[0].name, 'Prodotto di test al giorno')
self.assertEqual(
Expand All @@ -106,7 +106,7 @@ def test_00_xml_import(self):
invoice.e_invoice_line_ids[0].tax_amount, 0)
self.assertEqual(
invoice.e_invoice_line_ids[0].tax_kind, 'N4')
self.assertTrue(len(invoice.e_invoice_line_ids[0].other_data_ids)==2)
self.assertTrue(len(invoice.e_invoice_line_ids[0].other_data_ids) == 2)
self.assertEqual(
invoice.e_invoice_line_ids[0].other_data_ids[0].text_ref,
'Riferimento')
Expand Down Expand Up @@ -190,7 +190,7 @@ def test_04_xml_import(self):
invoice.invoice_line_ids[1].invoice_line_tax_ids[0].amount, 22)
self.assertEqual(
invoice.invoice_line_ids[1].price_unit, 2)
self.assertTrue(len(invoice.e_invoice_line_ids)==2)
self.assertTrue(len(invoice.e_invoice_line_ids) == 2)
for e_line in invoice.e_invoice_line_ids:
self.assertTrue(e_line.line_number in (1, 2))
if e_line.line_number == 1:
Expand Down Expand Up @@ -225,7 +225,8 @@ def test_05_xml_import(self):
'SC')
self.assertEqual(
invoice.e_invoice_line_ids[0].discount_rise_price_ids[0].
percentage, 10)
percentage, 10
)
self.assertEqual(invoice.amount_untaxed, 15)
self.assertEqual(invoice.amount_tax, 0)
self.assertEqual(invoice.amount_total, 15)
Expand Down Expand Up @@ -417,4 +418,4 @@ def test_16_xml_import(self):
invoices = self.invoice_model.browse(invoice_ids)
self.assertTrue(len(invoices) == 2)
for invoice in invoices:
self.assertTrue(len(invoice.invoice_line_ids) == 0)
self.assertTrue(len(invoice.invoice_line_ids) == 0)
3 changes: 1 addition & 2 deletions l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,6 @@ def invoiceCreate(
))
invoice_data['ftpa_withholding_type'] = Withholding.TipoRitenuta
# 2.2.1
CodeArts = self.env['fatturapa.article.code']
e_invoice_line_ids = []
for line in FatturaBody.DatiBeniServizi.DettaglioLinee:
if self.e_invoice_detail_level == '2':
Expand Down Expand Up @@ -1296,7 +1295,7 @@ def importFatturaPA(self):
else:
invoice_inconsistencies = ''
invoice.inconsistencies = (
generic_inconsistencies + invoice_inconsistencies)
generic_inconsistencies + invoice_inconsistencies)

return {
'view_type': 'form',
Expand Down
2 changes: 1 addition & 1 deletion l10n_it_fatturapa_out/models/attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright 2016 Lorenzo Battistini - Agile Business Group
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import fields, models, api
from odoo import fields, models


class FatturaPAAttachment(models.Model):
Expand Down
2 changes: 1 addition & 1 deletion l10n_it_fatturapa_out/tests/fatturapa_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,4 @@ def getFile(self, filename, module_name=None):
if module_name is None:
module_name = 'l10n_it_fatturapa_out'
path = get_module_resource(module_name, 'tests', 'data', filename)
return self.getFilePath(path)
return self.getFilePath(path)
1 change: 0 additions & 1 deletion l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ def _setDatiAnagraficiCessionario(self, partner, fatturapa):
Nome=partner.firstname
)


if partner.eori_code:
fatturapa.FatturaElettronicaHeader.CessionarioCommittente.\
DatiAnagrafici.Anagrafica.CodEORI = partner.eori_code
Expand Down
78 changes: 78 additions & 0 deletions l10n_it_fatturapa_out_ddt/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
=========================
Fattura Elettronica & DDT
=========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-italy/tree/10.0/l10n_it_fatturapa_out_ddt
:alt: OCA/l10n-italy
.. |badge4| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/122/10.0
:alt: Try me on Runbot

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

Il modulo permette all'utente di scegliere se e come riempire i campi dell'XML della fattura elettronica con i dati relativi al DDT, nei due scenari di fattura differita e fattura accompagnatoria

**Table of contents**

.. contents::
:local:

Usage
=====

Nel wizard di esportazione della fattura elettronica, è possibile scegliere 'Includi Dati DDT' o 'Includi Dati Trasporto'.

Nel primo caso viene gestito il blocco da valorizzare nei casi di fattura "differita" per indicare il documento con cui è stato consegnato il bene.

Nel secondo il blocco valorizzabile nei casi di fattura "accompagnatoria" per inserire informazioni relative al trasporto

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 smashing it by providing a detailed and welcomed feedback.

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

Credits
=======

Authors
~~~~~~~

* Agile Business Group

Contributors
~~~~~~~~~~~~

* Lorenzo Battistini

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/10.0/l10n_it_fatturapa_out_ddt>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions l10n_it_fatturapa_out_ddt/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).

from . import wizard
25 changes: 25 additions & 0 deletions l10n_it_fatturapa_out_ddt/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Lorenzo Battistini
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).

{
"name": "Fattura Elettronica & DDT",
"summary": "Bridge module",
"version": "10.0.1.0.0",
"development_status": "Beta",
"category": "Hidden",
"website": "https://github.com/OCA/l10n-italy",
"author": "Agile Business Group, Odoo Community Association (OCA)",
"maintainers": [],
"license": "LGPL-3",
"application": False,
"installable": True,
"auto_install": True,
"depends": [
"l10n_it_fatturapa_out",
"l10n_it_ddt",
],
"data": [
"wizard/wizard_export_fatturapa_view.xml"
],
}
50 changes: 50 additions & 0 deletions l10n_it_fatturapa_out_ddt/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_it_fatturapa_out_ddt
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-24 16:24+0000\n"
"PO-Revision-Date: 2018-09-24 16:24+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: l10n_it_fatturapa_out_ddt
#: model:ir.model.fields,field_description:l10n_it_fatturapa_out_ddt.field_wizard_export_fatturapa_include_ddt_data
msgid "Dati DDT"
msgstr "Dati DDT"

#. module: l10n_it_fatturapa_out_ddt
#: model:ir.model,name:l10n_it_fatturapa_out_ddt.model_wizard_export_fatturapa
msgid "Export FatturaPA"
msgstr "Esporta fattura elettronica"

#. module: l10n_it_fatturapa_out_ddt
#: selection:wizard.export.fatturapa,include_ddt_data:0
msgid "Includi Dati DDT"
msgstr "Includi Dati DDT"

#. module: l10n_it_fatturapa_out_ddt
#: model:ir.model.fields,help:l10n_it_fatturapa_out_ddt.field_wizard_export_fatturapa_include_ddt_data
msgid "Includi Dati DDT: Blocco da valorizzare nei casi di fattura \"differita\" per indicare il documento con cui è stato consegnato il bene\n"
"Includi Dati Trasporto: Blocco valorizzabile nei casi di fattura \"accompagnatoria\" per inserire informazioni relative al trasporto"
msgstr "Includi Dati DDT: Blocco da valorizzare nei casi di fattura \"differita\" per indicare il documento con cui è stato consegnato il bene\n"
"Includi Dati Trasporto: Blocco valorizzabile nei casi di fattura \"accompagnatoria\" per inserire informazioni relative al trasporto"

#. module: l10n_it_fatturapa_out_ddt
#: selection:wizard.export.fatturapa,include_ddt_data:0
msgid "Includi Dati Trasporto"
msgstr "Includi Dati Trasporto"

#. module: l10n_it_fatturapa_out_ddt
#: code:addons/l10n_it_fatturapa_out_ddt/wizard/wizard_export_fatturapa.py:82
#, python-format
msgid "TIN not set for %s"
msgstr "Partita IVA non impostata per %s"

1 change: 1 addition & 0 deletions l10n_it_fatturapa_out_ddt/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Lorenzo Battistini
1 change: 1 addition & 0 deletions l10n_it_fatturapa_out_ddt/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Il modulo permette all'utente di scegliere se e come riempire i campi dell'XML della fattura elettronica con i dati relativi al DDT, nei due scenari di fattura differita e fattura accompagnatoria
5 changes: 5 additions & 0 deletions l10n_it_fatturapa_out_ddt/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Nel wizard di esportazione della fattura elettronica, è possibile scegliere 'Includi Dati DDT' o 'Includi Dati Trasporto'.

Nel primo caso viene gestito il blocco da valorizzare nei casi di fattura "differita" per indicare il documento con cui è stato consegnato il bene.

Nel secondo il blocco valorizzabile nei casi di fattura "accompagnatoria" per inserire informazioni relative al trasporto
4 changes: 4 additions & 0 deletions l10n_it_fatturapa_out_ddt/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).

from . import test_fatturapa_ddt
Loading

0 comments on commit 5ee52c2

Please sign in to comment.