-
-
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.
[IMP] l10n_it_website_sale_fiscalcode: black, isort, prettier
- Loading branch information
Showing
5 changed files
with
52 additions
and
38 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
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 |
---|---|---|
@@ -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 |
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
1 change: 1 addition & 0 deletions
1
setup/l10n_it_website_sale_fiscalcode/odoo/addons/l10n_it_website_sale_fiscalcode
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 @@ | ||
../../../../l10n_it_website_sale_fiscalcode |
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,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |