Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.0] porting l10n_it_fatturapa_in and supporting B2B (in and out) #589

Merged
merged 5 commits into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion l10n_it_account/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{
'name': 'Italian Localization - Account',
'version': '10.0.1.2.2',
'version': '10.0.1.2.3',
'category': 'Hidden',
'author': "Agile Business Group, Abstract, "
"Odoo Community Association (OCA)",
Expand Down
10 changes: 10 additions & 0 deletions l10n_it_account/models/account_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ class AccountTax(models.Model):
'account.tax', 'account_tax_filiation_rel', 'child_tax', 'parent_tax',
string='Parent Taxes')

def _get_tax_amount(self):
self.ensure_one()
res = 0.0
if self.amount_type == 'group':
for child in self.children_tax_ids:
res += child.amount
else:
res = self.amount
return res

def _get_tax_name(self):
self.ensure_one()
name = self.name
Expand Down
94 changes: 69 additions & 25 deletions l10n_it_fatturapa/README.rst
Original file line number Diff line number Diff line change
@@ -1,53 +1,97 @@
.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3

Italian Localization - FatturaPA
================================

Base module to handle FatturaPA data.
=================================================
Italian Localization - Fattura Elettronica - Base
=================================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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
: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-10-0/l10n-italy-10-0-l10n_it_fatturapa
:alt: Translate me on Weblate
.. |badge5| 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| |badge5|

Base module to handle Electronic Invoices.
http://fatturapa.gov.it

See l10n_it_fatturapa_out and l10n_it_fatturapa_in.
See also l10n_it_fatturapa_out and l10n_it_fatturapa_in README files.

**Table of contents**

.. contents::
:local:

Installation
============

This module requires PyXB 1.2.5
http://pyxb.sourceforge.net/


Configuration
=============

* Edit the FatturaPA fields of the partners (in partner form) who will receive (send) the
electronic invoices. IPA code is mandatory, EORI code is not.
* In partner form, select 'Subjected to electronic invoice' in Electronic Invoice tab for customers and suppliers subjected to electronic invoicing
* Public administrations must have IPA code
* Others must have Codice Destinatario
* Configure taxes about 'Non taxable nature', 'Law reference' and 'VAT payability'
* Configure FatturaPA data in Accounting Configuration. Note that a sequence 'fatturaPA' is already loaded by the module and selectable.
* Configure Electronic Invoice data in Accounting Configuration, where needed.

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 <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_fatturapa%0Aversion:%2010.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.

Credits
=======

Contributors
------------
Authors
~~~~~~~

* Davide Corio
* Agile Business Group
* Innoviu
* Odoo Italia Network

* Davide Corio <davide.corio@abstract.it>
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
* Roberto Onnis <roberto.onnis@innoviu.com>
* Alessio Gerace <alessio.gerace@agilebg.com>
Contributors
~~~~~~~~~~~~

Maintainer
----------
* Davide Corio
* Lorenzo Battistini <https://github.com/eLBati>
* Roberto Onnis
* Alessio Gerace

.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org
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.

To contribute to this module, please visit http://odoo-community.org.
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/10.0/l10n_it_fatturapa>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions l10n_it_fatturapa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@

from . import models
from . import bindings
from . import controllers
9 changes: 6 additions & 3 deletions l10n_it_fatturapa/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
'name': 'Italian Localization - FatturaPA',
'version': '10.0.1.1.0',
'name': 'Italian Localization - Fattura Elettronica - Base',
'version': '10.0.2.0.0',
'category': 'Localization/Italy',
'summary': 'Electronic invoices',
'author': 'Davide Corio, Agile Business Group, Innoviu, '
'Odoo Italia Network, Odoo Community Association (OCA)',
'website': 'https://odoo-community.org',
'license': 'LGPL-3',
"depends": [
'account',
'l10n_it_account',
'l10n_it_fiscalcode',
'document',
'l10n_it_ipa',
Expand All @@ -22,6 +22,9 @@
'l10n_it_account_tax_kind',
'l10n_it_esigibilita_iva',
'l10n_it_fiscal_payment_term',
'l10n_it_split_payment',
'l10n_it_fiscal_document_type',
'partner_firstname',
],
"data": [
'data/fatturapa_data.xml',
Expand Down
15 changes: 10 additions & 5 deletions l10n_it_fatturapa/bindings/fatturapa_v_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1305,8 +1305,13 @@ class String60LatinType (pyxb.binding.datatypes.normalizedString):
2)
_Documentation = None
String60LatinType._CF_pattern = pyxb.binding.facets.CF_pattern()
# strings of blank spaces are allowed by SDI.
# {1,60} would produce
# SimpleFacetValueError: Type
# {http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2}
# String1000LatinType pattern constraint violated by value
String60LatinType._CF_pattern.addPattern(
pattern='[\\p{IsBasicLatin}\\p{IsLatin-1Supplement}]{1,60}')
pattern='[\\p{IsBasicLatin}\\p{IsLatin-1Supplement}]{0,60}')
String60LatinType._InitializeFacetMap(String60LatinType._CF_pattern)
Namespace.addCategoryObject(
'typeBinding',
Expand All @@ -1332,7 +1337,7 @@ class String80LatinType (pyxb.binding.datatypes.normalizedString):
_Documentation = None
String80LatinType._CF_pattern = pyxb.binding.facets.CF_pattern()
String80LatinType._CF_pattern.addPattern(
pattern='[\\p{IsBasicLatin}\\p{IsLatin-1Supplement}]{1,80}')
pattern='[\\p{IsBasicLatin}\\p{IsLatin-1Supplement}]{0,80}')
String80LatinType._InitializeFacetMap(String80LatinType._CF_pattern)
Namespace.addCategoryObject(
'typeBinding',
Expand All @@ -1359,7 +1364,7 @@ class String100LatinType (pyxb.binding.datatypes.normalizedString):
_Documentation = None
String100LatinType._CF_pattern = pyxb.binding.facets.CF_pattern()
String100LatinType._CF_pattern.addPattern(
pattern='[\\p{IsBasicLatin}\\p{IsLatin-1Supplement}]{1,100}')
pattern='[\\p{IsBasicLatin}\\p{IsLatin-1Supplement}]{0,100}')
String100LatinType._InitializeFacetMap(String100LatinType._CF_pattern)
Namespace.addCategoryObject(
'typeBinding',
Expand All @@ -1386,7 +1391,7 @@ class String200LatinType (pyxb.binding.datatypes.normalizedString):
_Documentation = None
String200LatinType._CF_pattern = pyxb.binding.facets.CF_pattern()
String200LatinType._CF_pattern.addPattern(
pattern='[\\p{IsBasicLatin}\\p{IsLatin-1Supplement}]{1,200}')
pattern='[\\p{IsBasicLatin}\\p{IsLatin-1Supplement}]{0,200}')
String200LatinType._InitializeFacetMap(String200LatinType._CF_pattern)
Namespace.addCategoryObject(
'typeBinding',
Expand All @@ -1413,7 +1418,7 @@ class String1000LatinType (pyxb.binding.datatypes.normalizedString):
_Documentation = None
String1000LatinType._CF_pattern = pyxb.binding.facets.CF_pattern()
String1000LatinType._CF_pattern.addPattern(
pattern='[\\p{IsBasicLatin}\\p{IsLatin-1Supplement}]{1,1000}')
pattern='[\\p{IsBasicLatin}\\p{IsLatin-1Supplement}]{0,1000}')
String1000LatinType._InitializeFacetMap(String1000LatinType._CF_pattern)
Namespace.addCategoryObject(
'typeBinding',
Expand Down
3 changes: 3 additions & 0 deletions l10n_it_fatturapa/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

from . import main
19 changes: 19 additions & 0 deletions l10n_it_fatturapa/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-

from odoo.http import Controller, route, request


class FatturaElettronicaController(Controller):

@route([
'/fatturapa/preview/<attachment_id>',
], type='http', auth='user', website=True)
def pdf_preview(self, attachment_id, **data):
attach = request.env['ir.attachment'].browse(int(attachment_id))
html = attach.get_fattura_elettronica_preview()
pdf = request.env['report']._run_wkhtmltopdf(
[], [], [[False, html]], None, None)
pdfhttpheaders = [
('Content-Type', 'application/pdf'), ('Content-Length', len(pdf))
]
return request.make_response(pdf, headers=pdfhttpheaders)
Loading