-
-
Notifications
You must be signed in to change notification settings - Fork 305
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
[14.0][MIG] l10n_it_website_portal_fatturapa #2520
Merged
OCA-git-bot
merged 8 commits into
OCA:14.0
from
Borruso:14.0-mig-l10n_it_website_portal_fatturapa
Mar 1, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
418a959
[ADD] l10n_it_website_portal_fatturapa
monen17 c9d7a9b
porting l10n_it_website_portal_fatturapa to 12
eLBati 90a8a9e
FIX l10n_it_website_portal_fatturapa view dependency
eLBati d860db5
[IMP] l10n_it_website_portal_fatturapa: Add PA check, IPA and EORI code
SimoRubi 3d0fbcb
[FIX] l10n_it_website_portal_fatturapa: Fix electronic invoice label
SimoRubi 030f28e
IMP l10n_it_website_portal_fatturapa: when customers set they are sub…
eLBati 9adc0a1
[IMP] l10n_it_website_portal_fatturapa: black, isort, prettier
Borruso 5d7b489
[MIG] l10n_it_website_portal_fatturapa: Migration to 14.0
Borruso File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,68 @@ | ||
=================================== | ||
ITA - Fattura elettronica - Portale | ||
=================================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! 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/14.0/l10n_it_website_portal_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-14-0/l10n-italy-14-0-l10n_it_website_portal_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/14.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
Allow frontend users to edit any necessary field for Electronic invoice from their *details* page. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
Fields `is_pa` and `ipa_code` are not shown in the frontend because Odoo core always supposes that frontend users are individual, and these fields are only meaningful for companies. | ||
|
||
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_portal_fatturapa%0Aversion:%2014.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/14.0/l10n_it_website_portal_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,19 @@ | ||
# Copyright 2019 Simone Rubino | ||
# Copyright 2019 Lorenzo Battistini | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "ITA - Fattura elettronica - Portale", | ||
"summary": "Add fatturapa fields and checks in frontend user's details", | ||
"version": "14.0.1.0.0", | ||
"author": "Odoo Community Association (OCA)", | ||
"category": "Localization/Italy", | ||
"website": "https://github.com/OCA/l10n-italy", | ||
"license": "AGPL-3", | ||
"depends": [ | ||
"l10n_it_fatturapa", | ||
"l10n_it_website_portal_fiscalcode", | ||
"l10n_it_website_portal_ipa", | ||
], | ||
"data": ["views/l10n_it_website_portal_fatturapa_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,3 @@ | ||
# 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,90 @@ | ||
# Copyright 2019 Simone Rubino | ||
# Copyright 2019 Lorenzo Battistini | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from odoo.exceptions import ValidationError | ||
from odoo.http import request | ||
from odoo.tools.translate import _ | ||
|
||
from odoo.addons.l10n_it_website_portal_fiscalcode.controllers.main import ( | ||
WebsitePortalFiscalCode, | ||
) | ||
|
||
FATTURAPA_PORTAL_FIELDS = [ | ||
"codice_destinatario", | ||
"firstname", | ||
"lastname", | ||
"pec_destinatario", | ||
"country_id", | ||
"fiscalcode", | ||
"zipcode", | ||
"vat", | ||
"electronic_invoice_subjected", | ||
"street", | ||
"city", | ||
"is_pa", | ||
"ipa_code", | ||
"eori_code", | ||
"electronic_invoice_obliged_subject", | ||
] | ||
WebsitePortalFiscalCode.OPTIONAL_BILLING_FIELDS.extend(FATTURAPA_PORTAL_FIELDS) | ||
|
||
|
||
class WebsitePortalFatturapa(WebsitePortalFiscalCode): | ||
def details_form_validate(self, data): | ||
# when checkbox electronic_invoice_subjected is not checked, | ||
# it is not posted | ||
data["electronic_invoice_subjected"] = data.get( | ||
"electronic_invoice_subjected", False | ||
) | ||
if data["electronic_invoice_subjected"]: | ||
data["electronic_invoice_obliged_subject"] = True | ||
error, error_message = super( | ||
WebsitePortalFatturapa, self | ||
).details_form_validate(data) | ||
partner_sudo = request.env.user.partner_id.sudo() | ||
error, error_message = self.validate_partner_firstname( | ||
data, error, error_message | ||
) | ||
|
||
partner_values = self.get_portal_fatturapa_partner_values(data, partner_sudo) | ||
dummy_partner = request.env["res.partner"].new(partner_values) | ||
try: | ||
dummy_partner._check_ftpa_partner_data() | ||
except ValidationError as ve: | ||
error["error"] = "error" | ||
error_message.append(ve.name) | ||
return error, error_message | ||
|
||
def get_portal_fatturapa_partner_values(self, data, partner_sudo): | ||
# Read all the fields for the constraint from the current user | ||
constr_fields = partner_sudo._check_ftpa_partner_data._constrains | ||
partner_values = partner_sudo.read(constr_fields)[0] | ||
|
||
# Update them with fields that might be edited by the user | ||
new_partner_values = { | ||
f_name: data.get(f_name) for f_name in FATTURAPA_PORTAL_FIELDS | ||
} | ||
if new_partner_values.get("country_id"): | ||
new_partner_values["country_id"] = int(new_partner_values["country_id"]) | ||
new_partner_values.update({"zip": new_partner_values.pop("zipcode", "")}) | ||
partner_values.update(new_partner_values) | ||
return partner_values | ||
|
||
def validate_partner_firstname(self, data, error, error_message): | ||
# Compute name field, using First name and Last name | ||
if all(f in data for f in ["name", "firstname", "lastname"]): | ||
lastname = data.get("lastname") | ||
firstname = data.get("firstname") | ||
if lastname or firstname: | ||
data.update( | ||
name=request.env["res.partner"]._get_computed_name( | ||
lastname, firstname | ||
) | ||
) | ||
else: | ||
error["firstname"] = "error" | ||
error["lastname"] = "error" | ||
error_message.append( | ||
_("At least one of first name and last name is required") | ||
) | ||
return error, error_message | ||
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,53 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * l10n_it_website_portal_fatturapa | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2019-12-09 12:04+0000\n" | ||
"Last-Translator: Lorenzo Battistini <[email protected]>\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.9.1\n" | ||
|
||
#. module: l10n_it_website_portal_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_portal_fatturapa.fatturapa_details | ||
msgid "Addressee code" | ||
msgstr "Codice destinatario" | ||
|
||
#. module: l10n_it_website_portal_fatturapa | ||
#: code:addons/l10n_it_website_portal_fatturapa/controllers/main.py:72 | ||
#, python-format | ||
msgid "At least one of first name and last name is required" | ||
msgstr "Almeno uno fra nome e cognome è richiesto" | ||
|
||
#. module: l10n_it_website_portal_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_portal_fatturapa.fatturapa_details | ||
msgid "EORI code" | ||
msgstr "Codice EORI" | ||
|
||
#. module: l10n_it_website_portal_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_portal_fatturapa.fatturapa_details | ||
msgid "Enable receiving electronic invoice" | ||
msgstr "Abilitare la ricezione della fattura elettronica" | ||
|
||
#. module: l10n_it_website_portal_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_portal_fatturapa.fatturapa_details | ||
msgid "Or PEC address for Electronic invoicing" | ||
msgstr "O indirizzo PEC per la fatturazione elettronica" | ||
|
||
#. module: l10n_it_website_portal_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_portal_fatturapa.fatturapa_details | ||
msgid "Your First Name" | ||
msgstr "Il tuo nome" | ||
|
||
#. module: l10n_it_website_portal_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_portal_fatturapa.fatturapa_details | ||
msgid "Your Last Name" | ||
msgstr "Il tuo cognome" |
51 changes: 51 additions & 0 deletions
51
l10n_it_website_portal_fatturapa/i18n/l10n_it_website_portal_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,51 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * l10n_it_website_portal_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_portal_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_portal_fatturapa.fatturapa_details | ||
msgid "Addressee code" | ||
msgstr "" | ||
|
||
#. module: l10n_it_website_portal_fatturapa | ||
#: code:addons/l10n_it_website_portal_fatturapa/controllers/main.py:72 | ||
#, python-format | ||
msgid "At least one of first name and last name is required" | ||
msgstr "" | ||
|
||
#. module: l10n_it_website_portal_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_portal_fatturapa.fatturapa_details | ||
msgid "EORI code" | ||
msgstr "" | ||
|
||
#. module: l10n_it_website_portal_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_portal_fatturapa.fatturapa_details | ||
msgid "Enable receiving electronic invoice" | ||
msgstr "" | ||
|
||
#. module: l10n_it_website_portal_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_portal_fatturapa.fatturapa_details | ||
msgid "Or PEC address for Electronic invoicing" | ||
msgstr "" | ||
|
||
#. module: l10n_it_website_portal_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_portal_fatturapa.fatturapa_details | ||
msgid "Your First Name" | ||
msgstr "" | ||
|
||
#. module: l10n_it_website_portal_fatturapa | ||
#: model_terms:ir.ui.view,arch_db:l10n_it_website_portal_fatturapa.fatturapa_details | ||
msgid "Your Last Name" | ||
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 @@ | ||
Allow frontend users to edit any necessary field for Electronic invoice from their *details* page. |
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 @@ | ||
Fields `is_pa` and `ipa_code` are not shown in the frontend because Odoo core always supposes that frontend users are individual, and these fields are only meaningful for companies. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Borruso questa sezione si può rimuovere, i due campi sono ora visibili nel portale se l'utente è legato ad un partner di tipo company |
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cosa ne pensi di trasformare questo blocco in
? per via di questo #2520 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fatto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Borruso Grazie, un ultimo appunto è che si potrebbe importare il codice destinatario standard con "0000000" da qui https://github.com/OCA/l10n-italy/blob/14.0/l10n_it_fatturapa/models/partner.py#L7 , ma non so se ne vale la pena, decidete voi 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
puoi aprire una issue per tenerne traccia