diff --git a/l10n_it_website_portal_fiscalcode/__manifest__.py b/l10n_it_website_portal_fiscalcode/__manifest__.py index 4b39a189742f..9e1bff403496 100644 --- a/l10n_it_website_portal_fiscalcode/__manifest__.py +++ b/l10n_it_website_portal_fiscalcode/__manifest__.py @@ -7,15 +7,10 @@ "version": "12.0.1.0.2", "author": "Odoo Community Association (OCA)", "category": "Localization/Italy", - "website": "https://github.com/OCA/l10n-italy/tree/" - "12.0/l10n_it_website_portal_fiscalcode", + "website": "https://github.com/OCA/l10n-italy" + "12.0/l10n_it_website_portal_fiscalcode", "license": "AGPL-3", - "depends": [ - "l10n_it_fiscalcode", - "portal" - ], - "data": [ - "views/l10n_it_website_portal_fiscalcode_templates.xml" - ], + "depends": ["l10n_it_fiscalcode", "portal"], + "data": ["views/l10n_it_website_portal_fiscalcode_templates.xml"], "auto_install": True, } diff --git a/l10n_it_website_portal_fiscalcode/controllers/main.py b/l10n_it_website_portal_fiscalcode/controllers/main.py index 914729ee0fec..8137dc0fa468 100644 --- a/l10n_it_website_portal_fiscalcode/controllers/main.py +++ b/l10n_it_website_portal_fiscalcode/controllers/main.py @@ -2,36 +2,39 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import _ -from odoo.addons.portal.controllers.portal import CustomerPortal from odoo.http import request -CustomerPortal.OPTIONAL_BILLING_FIELDS.extend(['fiscalcode']) +from odoo.addons.portal.controllers.portal import CustomerPortal + +CustomerPortal.OPTIONAL_BILLING_FIELDS.extend(["fiscalcode"]) class WebsitePortalFiscalCode(CustomerPortal): - def details_form_validate(self, data): - error, error_message = \ - super(WebsitePortalFiscalCode, self).details_form_validate(data) + error, error_message = super( + WebsitePortalFiscalCode, self + ).details_form_validate(data) # Check fiscalcode partner = request.env.user.partner_id # company_type does not come from page form company_type = partner.company_type company_name = False - if 'company_name' in data: - company_name = data.get('company_name') + if "company_name" in data: + company_name = data.get("company_name") else: # when company_name is not posted (readonly) if partner.company_name: company_name = partner.company_name - elif partner.company_type == 'company': + elif partner.company_type == "company": company_name = partner.name - dummy_partner = request.env['res.partner'].new({ - 'fiscalcode': data.get('fiscalcode'), - 'company_name': company_name, - 'company_type': company_type, - }) + dummy_partner = request.env["res.partner"].new( + { + "fiscalcode": data.get("fiscalcode"), + "company_name": company_name, + "company_type": company_type, + } + ) if not dummy_partner.check_fiscalcode(): - error['fiscalcode'] = 'error' - error_message.append(_('Fiscal Code not valid')) + error["fiscalcode"] = "error" + error_message.append(_("Fiscal Code not valid")) return error, error_message diff --git a/l10n_it_website_portal_fiscalcode/views/l10n_it_website_portal_fiscalcode_templates.xml b/l10n_it_website_portal_fiscalcode/views/l10n_it_website_portal_fiscalcode_templates.xml index e6c2abe04b53..caba90c0b3f1 100644 --- a/l10n_it_website_portal_fiscalcode/views/l10n_it_website_portal_fiscalcode_templates.xml +++ b/l10n_it_website_portal_fiscalcode/views/l10n_it_website_portal_fiscalcode_templates.xml @@ -4,16 +4,31 @@ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> -