From 11cd4caec953d34eb5e3bf7b7cd4712044ccb05a Mon Sep 17 00:00:00 2001 From: Alberto Carollo Date: Thu, 16 Mar 2023 10:25:55 +0100 Subject: [PATCH] [IMP] l10n_it_website_sale_fiscalcode: black, isort, prettier --- .../__manifest__.py | 28 ++++++++--------- .../controllers/main.py | 30 +++++++++++-------- .../views/templates.xml | 25 ++++++++++------ .../addons/l10n_it_website_sale_fiscalcode | 1 + .../l10n_it_website_sale_fiscalcode/setup.py | 6 ++++ 5 files changed, 52 insertions(+), 38 deletions(-) create mode 120000 setup/l10n_it_website_sale_fiscalcode/odoo/addons/l10n_it_website_sale_fiscalcode create mode 100644 setup/l10n_it_website_sale_fiscalcode/setup.py diff --git a/l10n_it_website_sale_fiscalcode/__manifest__.py b/l10n_it_website_sale_fiscalcode/__manifest__.py index 218831728142..2abc05252787 100644 --- a/l10n_it_website_sale_fiscalcode/__manifest__.py +++ b/l10n_it_website_sale_fiscalcode/__manifest__.py @@ -3,21 +3,17 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { - 'name': 'Website Sale FiscalCode', - 'category': 'e-commerce', - 'author': "Agile Business Group," - "Odoo Community Association (OCA)", - 'version': '12.0.1.1.3', - 'license': 'AGPL-3', - 'website': 'https://github.com/OCA/l10n-italy' - '/tree/12.0/l10n_it_website_sale_fiscalcode', - 'depends': [ - 'website_sale', - 'l10n_it_fiscalcode' + "name": "Website Sale FiscalCode", + "category": "e-commerce", + "author": "Agile Business Group," "Odoo Community Association (OCA)", + "version": "12.0.1.1.3", + "license": "AGPL-3", + "website": "https://github.com/OCA/l10n-italy" + "/tree/12.0/l10n_it_website_sale_fiscalcode", + "depends": ["website_sale", "l10n_it_fiscalcode"], + "data": [ + "views/templates.xml", ], - 'data': [ - 'views/templates.xml', - ], - 'installable': True, - 'auto_install': True, + "installable": True, + "auto_install": True, } diff --git a/l10n_it_website_sale_fiscalcode/controllers/main.py b/l10n_it_website_sale_fiscalcode/controllers/main.py index 1849e0a863ed..0cc5d47071ea 100644 --- a/l10n_it_website_sale_fiscalcode/controllers/main.py +++ b/l10n_it_website_sale_fiscalcode/controllers/main.py @@ -1,31 +1,35 @@ # Copyright 2017 Nicola Malcontenti - Agile Business Group +from odoo import _ from odoo.http import request + from odoo.addons.website_sale.controllers.main import WebsiteSale -from odoo import _ class WebsiteSaleFiscalCode(WebsiteSale): - def _checkout_form_save(self, mode, checkout, all_values): res = super(WebsiteSaleFiscalCode, self)._checkout_form_save( - mode, checkout, all_values) + mode, checkout, all_values + ) partner_values = dict() - if 'fiscalcode' not in checkout and 'fiscalcode' in all_values: - partner_values['fiscalcode'] = all_values['fiscalcode'] + if "fiscalcode" not in checkout and "fiscalcode" in all_values: + partner_values["fiscalcode"] = all_values["fiscalcode"] if partner_values: - request.env['res.partner'].browse(res).sudo().write(partner_values) + request.env["res.partner"].browse(res).sudo().write(partner_values) return res def checkout_form_validate(self, mode, all_form_values, data): error, error_message = super().checkout_form_validate( - mode, all_form_values, data) + mode, all_form_values, data + ) partner_sudo = request.env.user.partner_id.sudo() - dummy_partner = request.env['res.partner'].new({ - 'fiscalcode': data.get('fiscalcode'), - 'is_company': partner_sudo.is_company - }) + dummy_partner = request.env["res.partner"].new( + { + "fiscalcode": data.get("fiscalcode"), + "is_company": partner_sudo.is_company, + } + ) 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_sale_fiscalcode/views/templates.xml b/l10n_it_website_sale_fiscalcode/views/templates.xml index e0aeebf094cf..f1332d97378c 100644 --- a/l10n_it_website_sale_fiscalcode/views/templates.xml +++ b/l10n_it_website_sale_fiscalcode/views/templates.xml @@ -1,18 +1,25 @@ - + -