-
-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] l10n_it_website_sale_fatturapa: Migration to 14.0
- Loading branch information
Showing
14 changed files
with
758 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
====================================================== | ||
Italian Localization - Fattura Elettronica - eCommerce | ||
====================================================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! 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-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/12.0/l10n_it_website_sale_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-12-0/l10n-italy-12-0-l10n_it_website_sale_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/12.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
**Italiano** | ||
|
||
Questo modulo permette di inserire tutti i campi necessari per la fatturazione elettronica nel form del checkout. | ||
|
||
**English** | ||
|
||
This module allows to insert all the fields that are relevant to Electronic invoicing in the checkout form. | ||
|
||
**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 smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_website_sale_fatturapa%0Aversion:%2012.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 | ||
======= | ||
|
||
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/12.0/l10n_it_website_sale_fatturapa>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2019 Simone Rubino | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import controllers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2019 Simone Rubino | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Italian Localization - Fattura Elettronica - eCommerce", | ||
"summary": "Aggiunge i campi necessari alla fatturazione elettronica " | ||
"nel form del checkout", | ||
"version": "14.0.1.0.0", | ||
"category": "Localization/Italy", | ||
"website": "https://github.com/OCA/l10n-italy" | ||
"/tree/14.0/l10n_it_website_sale_fatturapa", | ||
"author": "Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"depends": [ | ||
"l10n_it_fatturapa", | ||
"l10n_it_website_sale_fiscalcode" | ||
], | ||
"data": [ | ||
"views/templates.xml" | ||
], | ||
"auto_install": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2019 Simone Rubino | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Copyright 2019 Simone Rubino | ||
# Copyright 2019 Lorenzo Battistini | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo.addons.website_sale.controllers.main import WebsiteSale | ||
from odoo.exceptions import ValidationError | ||
from odoo.http import request | ||
|
||
|
||
class WebsiteSaleFatturapa(WebsiteSale): | ||
|
||
def _get_fatturapa_fields(self): | ||
"""Fields that can be changed by the user in frontend""" | ||
return ['firstname', 'lastname', 'codice_destinatario', | ||
'pec_destinatario', 'electronic_invoice_subjected', | ||
'fiscalcode', 'vat', 'street', 'zip', 'city', 'country_id'] | ||
|
||
def values_preprocess(self, order, mode, values): | ||
pre_values = super().values_preprocess(order, mode, values) | ||
# Compute name field, using First name and Last name | ||
if all(f in values for f in ['name', 'firstname', 'lastname']): | ||
partner_model = request.env['res.partner'] | ||
pre_values.update( | ||
name=partner_model._get_computed_name( | ||
pre_values['lastname'], | ||
pre_values['firstname'])) | ||
return pre_values | ||
|
||
def checkout_form_validate(self, mode, all_form_values, data): | ||
error, error_message = super().checkout_form_validate( | ||
mode, all_form_values, data) | ||
|
||
# when checkbox electronic_invoice_subjected is not checked, | ||
# it is not posted | ||
data['electronic_invoice_subjected'] = data.get( | ||
'electronic_invoice_subjected', False) | ||
partner_model = request.env['res.partner'] | ||
# Gather the value of each field that needs to be | ||
# checked for fatturapa constraint from the current partner | ||
partner_sudo = request.env.user.partner_id.sudo() | ||
check_fatturapa_fields = \ | ||
partner_model._check_ftpa_partner_data._constrains | ||
partner_values = partner_sudo.read(check_fatturapa_fields)[0] | ||
|
||
# Update values of the current partner with values changed by the user | ||
partner_values.update({ | ||
fatt_field: data.get(fatt_field) | ||
for fatt_field in self._get_fatturapa_fields() | ||
if fatt_field in data}) | ||
# Patch the country field as it is a m2o so it needs an int | ||
if partner_values.get('country_id'): | ||
partner_values['country_id'] = int(partner_values['country_id']) | ||
# This will be set later, during post_process | ||
# customer was removed in 13.0 | ||
# partner_values['customer'] = True | ||
|
||
partner_dummy = partner_model.new(partner_values) | ||
try: | ||
partner_dummy._check_ftpa_partner_data() | ||
except ValidationError as ve: | ||
error['fatturapa'] = 'error' | ||
error_message.append(ve.name) | ||
return error, error_message | ||
|
||
def _checkout_form_save(self, mode, checkout, all_values): | ||
for fatturapa_field in self._get_fatturapa_fields(): | ||
if fatturapa_field not in checkout \ | ||
and fatturapa_field in all_values: | ||
checkout[fatturapa_field] = all_values[fatturapa_field] | ||
return super()._checkout_form_save(mode, checkout, all_values) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * l10n_it_website_sale_fatturapa | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2019-10-17 15:32+0000\n" | ||
"Last-Translator: Lorenzo Battistini <lb@takobi.online>\n" | ||
"Language-Team: none\n" | ||
"Language: it\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 3.8\n" | ||
|
||
#. module: l10n_it_website_sale_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_sale_fatturapa.address | ||
msgid "Addressee code" | ||
msgstr "Codice destinatario" | ||
|
||
#. module: l10n_it_website_sale_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_sale_fatturapa.address | ||
msgid "First name" | ||
msgstr "Nome" | ||
|
||
#. module: l10n_it_website_sale_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_sale_fatturapa.address | ||
msgid "I request to receive electronic invoice" | ||
msgstr "Richiedo invio fattura elettronica" | ||
|
||
#. module: l10n_it_website_sale_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_sale_fatturapa.address | ||
msgid "Last name" | ||
msgstr "Cognome" | ||
|
||
#. module: l10n_it_website_sale_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_sale_fatturapa.address | ||
msgid "or PEC email" | ||
msgstr "o indirizzo PEC" |
40 changes: 40 additions & 0 deletions
40
l10n_it_website_sale_fatturapa/i18n/l10n_it_website_sale_fatturapa.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * l10n_it_website_sale_fatturapa | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0\n" | ||
"Report-Msgid-Bugs-To: \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_website_sale_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_sale_fatturapa.address | ||
msgid "Addressee code" | ||
msgstr "" | ||
|
||
#. module: l10n_it_website_sale_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_sale_fatturapa.address | ||
msgid "First name" | ||
msgstr "" | ||
|
||
#. module: l10n_it_website_sale_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_sale_fatturapa.address | ||
msgid "I request to receive electronic invoice" | ||
msgstr "" | ||
|
||
#. module: l10n_it_website_sale_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_sale_fatturapa.address | ||
msgid "Last name" | ||
msgstr "" | ||
|
||
#. module: l10n_it_website_sale_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_sale_fatturapa.address | ||
msgid "or PEC email" | ||
msgstr "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
**Italiano** | ||
|
||
Questo modulo permette di inserire tutti i campi necessari per la fatturazione elettronica nel form del checkout. | ||
|
||
**English** | ||
|
||
This module allows to insert all the fields that are relevant to Electronic invoicing in the checkout form. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.