@ -0,0 +1,49 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
||||
|
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
||||
|
:alt: License: AGPL-3 |
||||
|
|
||||
|
Website Sale Address Management |
||||
|
================================= |
||||
|
This Module Helps You to Filter Fields in Address Form and Show or Hide Fields by Switching on/off Toggles. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* No additional configurations needed |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
Affero General Public License, Version 3 (AGPL v3) |
||||
|
( https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developers: (Version 16) Rahul Rajeev @cybrosys , Jumana Jabin MP @cybrosys, |
||||
|
(Version 17) Sabeel B @cybrosys |
||||
|
(Version 18) Sruthi Renjith @cybrosys |
||||
|
Contact: odoo@cybrosys.com |
||||
|
|
||||
|
Contacts |
||||
|
-------- |
||||
|
* Mail Contact : odoo@cybrosys.com |
||||
|
* Website : https://cybrosys.com |
||||
|
|
||||
|
Bug Tracker |
||||
|
----------- |
||||
|
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
||||
|
|
||||
|
Maintainer |
||||
|
========== |
||||
|
.. image:: https://cybrosys.com/images/logo.png |
||||
|
:target: https://cybrosys.com |
||||
|
|
||||
|
This module is maintained by Cybrosys Technologies. |
||||
|
|
||||
|
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sruthi Renjith (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import controllers |
||||
|
from . import models |
@ -0,0 +1,56 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sruthi Renjith (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
{ |
||||
|
'name': "Website Sale Address Management", |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'Website', |
||||
|
'summary': """This module helps you to show or hide fields by switching |
||||
|
on/off toggles,set fields as mandatory or not and set default country.""", |
||||
|
'description': """This module helps you to show or hide fields by switching |
||||
|
on/off toggles.You can set fields as mandatory or not and also set default |
||||
|
country.All of these features can be changed from configuration settings |
||||
|
of Website module.""", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': "https://www.cybrosys.com", |
||||
|
'depends': ['website_sale'], |
||||
|
'data': [ |
||||
|
'views/res_config_settings_views.xml', |
||||
|
'views/website_sale_templates.xml', |
||||
|
], |
||||
|
'assets': { |
||||
|
'web.assets_backend': [ |
||||
|
'website_sale_address_management/static/src/css/address_management.css', |
||||
|
], |
||||
|
'web.assets_frontend': [ |
||||
|
'website_sale_address_management/static/src/js/website_sale_address.js' |
||||
|
], |
||||
|
}, |
||||
|
'images': [ |
||||
|
'static/description/banner.jpg', |
||||
|
], |
||||
|
'license': 'AGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False, |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sruthi Renjith (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import website_sale_address_management |
@ -0,0 +1,219 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sruthi Renjith (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import _ |
||||
|
from odoo.exceptions import ValidationError |
||||
|
from odoo.http import request |
||||
|
from odoo.addons.website_sale.controllers.main import WebsiteSale |
||||
|
from odoo.tools import single_email_re |
||||
|
|
||||
|
|
||||
|
class CustomWebsiteSale(WebsiteSale): |
||||
|
"""class used to monkey patch functions in class WebsiteSale""" |
||||
|
|
||||
|
def _get_mandatory_delivery_address_fields(self, country_sudo): |
||||
|
""" Function to get all the mandatory fields of delivery address """ |
||||
|
mandatory_fields = super()._get_mandatory_delivery_address_fields(country_sudo) |
||||
|
# Checking for custom mandatory fields. |
||||
|
if not request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'website_sale_address_management.' |
||||
|
'is_shipping_phone_is_required'): |
||||
|
mandatory_fields.remove('phone') |
||||
|
if not request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'website_sale_address_management.' |
||||
|
'is_shipping_zip_code_is_required'): |
||||
|
if "zip" in mandatory_fields: |
||||
|
mandatory_fields.remove('zip') |
||||
|
if not request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'website_sale_address_management.' |
||||
|
'is_shipping_street_is_required'): |
||||
|
mandatory_fields.remove('street') |
||||
|
if not request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'website_sale_address_management.' |
||||
|
'is_shipping_city_is_required'): |
||||
|
mandatory_fields.remove('city') |
||||
|
return mandatory_fields |
||||
|
|
||||
|
def _get_mandatory_billing_address_fields(self, country_sudo): |
||||
|
""" Function to get all the mandatory fields of billing address """ |
||||
|
mandatory_fields = super()._get_mandatory_billing_address_fields(country_sudo) |
||||
|
# Checking for custom mandatory fields. |
||||
|
if not request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'website_sale_address_management.' |
||||
|
'is_billing_phone_is_required'): |
||||
|
mandatory_fields.remove('phone') |
||||
|
if not request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'website_sale_address_management.' |
||||
|
'is_billing_zip_code_is_required'): |
||||
|
if "zip" in mandatory_fields: |
||||
|
mandatory_fields.remove('zip') |
||||
|
if not request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'website_sale_address_management.' |
||||
|
'is_billing_street_is_required'): |
||||
|
mandatory_fields.remove('street') |
||||
|
if not request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'website_sale_address_management.' |
||||
|
'is_billing_city_is_required'): |
||||
|
mandatory_fields.remove('city') |
||||
|
return mandatory_fields |
||||
|
|
||||
|
def _validate_address_values( |
||||
|
self, |
||||
|
address_values, |
||||
|
partner_sudo, |
||||
|
address_type, |
||||
|
use_delivery_as_billing, |
||||
|
required_fields, |
||||
|
is_main_address, |
||||
|
**_kwargs, |
||||
|
): |
||||
|
""" Function for validating fields """ |
||||
|
# data: values after preprocess |
||||
|
invalid_fields = set() |
||||
|
missing_fields = set() |
||||
|
error_messages = [] |
||||
|
if partner_sudo: |
||||
|
name_change = ( |
||||
|
'name' in address_values |
||||
|
and partner_sudo.name |
||||
|
and address_values['name'] != partner_sudo.name |
||||
|
) |
||||
|
email_change = ( |
||||
|
'email' in address_values |
||||
|
and partner_sudo.email |
||||
|
and address_values['email'] != partner_sudo.email |
||||
|
) |
||||
|
# Prevent changing the partner name if invoices have been issued. |
||||
|
if name_change and not partner_sudo._can_edit_name(): |
||||
|
invalid_fields.add('name') |
||||
|
error_messages.append(_( |
||||
|
"Changing your name is not allowed once invoices have been issued for your" |
||||
|
" account. Please contact us directly for this operation." |
||||
|
)) |
||||
|
# Prevent changing the partner name or email if it is an internal user. |
||||
|
if (name_change or email_change) and not all(partner_sudo.user_ids.mapped('share')): |
||||
|
if name_change: |
||||
|
invalid_fields.add('name') |
||||
|
if email_change: |
||||
|
invalid_fields.add('email') |
||||
|
error_messages.append(_( |
||||
|
"If you are ordering for an external person, please place your order via the" |
||||
|
" backend. If you wish to change your name or email address, please do so in" |
||||
|
" the account settings or contact your administrator." |
||||
|
)) |
||||
|
# Prevent changing the VAT number if invoices have been issued. |
||||
|
if ( |
||||
|
'vat' in address_values |
||||
|
and address_values['vat'] != partner_sudo.vat |
||||
|
and not partner_sudo.can_edit_vat() |
||||
|
): |
||||
|
invalid_fields.add('vat') |
||||
|
error_messages.append(_( |
||||
|
"Changing VAT number is not allowed once document(s) have been issued for your" |
||||
|
" account. Please contact us directly for this operation." |
||||
|
)) |
||||
|
# Validate the email. |
||||
|
if address_values.get('email') and not single_email_re.match(address_values['email']): |
||||
|
invalid_fields.add('email') |
||||
|
error_messages.append(_("Invalid Email! Please enter a valid email address.")) |
||||
|
# Validate the VAT number. |
||||
|
ResPartnerSudo = request.env['res.partner'].sudo() |
||||
|
if ( |
||||
|
address_values.get('vat') and hasattr(ResPartnerSudo, 'check_vat') |
||||
|
and 'vat' not in invalid_fields |
||||
|
): |
||||
|
partner_dummy = ResPartnerSudo.new({ |
||||
|
fname: address_values[fname] |
||||
|
for fname in self._get_vat_validation_fields() |
||||
|
if fname in address_values |
||||
|
}) |
||||
|
try: |
||||
|
partner_dummy.check_vat() |
||||
|
except ValidationError as exception: |
||||
|
invalid_fields.add('vat') |
||||
|
error_messages.append(exception.args[0]) |
||||
|
# Build the set of required fields from the address form's requirements. |
||||
|
required_field_set = {f for f in required_fields.split(',') if f} |
||||
|
# Complete the set of required fields based on the address type. |
||||
|
country_id = address_values.get('country_id') |
||||
|
country = request.env['res.country'].browse(country_id) |
||||
|
if address_type == 'delivery' or use_delivery_as_billing: |
||||
|
required_field_set |= self._get_mandatory_delivery_address_fields(country) |
||||
|
if address_type == 'billing' or use_delivery_as_billing: |
||||
|
required_field_set |= self._get_mandatory_billing_address_fields(country) |
||||
|
if not is_main_address: |
||||
|
commercial_fields = ResPartnerSudo._commercial_fields() |
||||
|
for fname in commercial_fields: |
||||
|
if fname in required_field_set and fname not in address_values: |
||||
|
required_field_set.remove(fname) |
||||
|
if address_type == 'delivery': |
||||
|
# Checking for delivery address required fields and removing it if |
||||
|
# present in the required fields list. |
||||
|
if not request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'website_sale_address_management.' |
||||
|
'is_shipping_phone_is_required'): |
||||
|
if 'phone' in required_field_set: |
||||
|
required_field_set.remove('phone') |
||||
|
if not request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'website_sale_address_management.' |
||||
|
'is_shipping_zip_code_is_required'): |
||||
|
if 'zip' in required_field_set: |
||||
|
required_field_set.remove('zip') |
||||
|
if not request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'website_sale_address_management.' |
||||
|
'is_shipping_street_is_required'): |
||||
|
if 'street' in required_field_set: |
||||
|
required_field_set.remove('street') |
||||
|
if not request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'website_sale_address_management.' |
||||
|
'is_shipping_city_is_required'): |
||||
|
if 'city' in required_field_set: |
||||
|
required_field_set.remove('city') |
||||
|
elif address_type == 'billing': |
||||
|
# Checking for billing address required fields and removing it if |
||||
|
# present in the required fields list. |
||||
|
if not request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'website_sale_address_management.' |
||||
|
'is_billing_phone_is_required'): |
||||
|
if 'phone' in required_field_set: |
||||
|
required_field_set.remove('phone') |
||||
|
if not request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'website_sale_address_management.' |
||||
|
'is_billing_zip_code_is_required'): |
||||
|
if 'zip' in required_field_set: |
||||
|
required_field_set.remove('zip') |
||||
|
if not request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'website_sale_address_management.' |
||||
|
'is_billing_street_is_required'): |
||||
|
if 'street' in required_field_set: |
||||
|
required_field_set.remove('street') |
||||
|
if not request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'website_sale_address_management.' |
||||
|
'is_billing_city_is_required'): |
||||
|
if 'city' in required_field_set: |
||||
|
required_field_set.remove('city') |
||||
|
# Verify that no required field has been left empty. |
||||
|
for field_name in required_field_set: |
||||
|
if not address_values.get(field_name): |
||||
|
missing_fields.add(field_name) |
||||
|
if missing_fields: |
||||
|
error_messages.append(_("Some required fields are empty.")) |
||||
|
return invalid_fields, missing_fields, error_messages |
@ -0,0 +1,6 @@ |
|||||
|
## Module <website_sale_address_management> |
||||
|
|
||||
|
#### 04.06.2025 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
#### ADD |
||||
|
- Initial Commit for Website Sale Address Management |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sruthi Renjith (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import res_config_settings |
@ -0,0 +1,145 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Sruthi Renjith (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import api, fields, models |
||||
|
|
||||
|
|
||||
|
class ResConfigSettings(models.TransientModel): |
||||
|
"""Inheriting ResConfigSettings Model. |
||||
|
This class extends the functionality of the 'res.config.settings' |
||||
|
model.It allows customizing and managing configuration settings |
||||
|
for the module """ |
||||
|
_inherit = 'res.config.settings' |
||||
|
|
||||
|
is_billing_phone = fields.Boolean( |
||||
|
string="Billing Phone", |
||||
|
config_parameter='website_sale_address_management.is_billing_phone', |
||||
|
help="Enable or disable the option for billing phone") |
||||
|
is_billing_phone_is_required = fields.Boolean( |
||||
|
string="Billing Phone Required", |
||||
|
config_parameter='website_sale_address_management' |
||||
|
'.is_billing_phone_is_required', |
||||
|
help="Specify whether billing phone is required") |
||||
|
is_billing_street = fields.Boolean( |
||||
|
string="Billing Street", |
||||
|
config_parameter='website_sale_address_management.is_billing_street', |
||||
|
help="Enable or disable the option for billing street") |
||||
|
is_billing_street_is_required = fields.Boolean( |
||||
|
string="Billing Street Is Required", |
||||
|
config_parameter='website_sale_address_management.' |
||||
|
'is_billing_street_is_required', |
||||
|
help="Specify whether billing street is required") |
||||
|
is_billing_street2 = fields.Boolean( |
||||
|
string="Billing Street 2", |
||||
|
config_parameter='website_sale_address_management.is_billing_street2', |
||||
|
help="Enable or disable the option for billing street 2") |
||||
|
is_billing_city = fields.Boolean( |
||||
|
string="Billing City", |
||||
|
config_parameter='website_sale_address_management.is_billing_city', |
||||
|
help="Enable or disable the option for billing city") |
||||
|
is_billing_city_is_required = fields.Boolean( |
||||
|
string="Billing City Is Required", |
||||
|
config_parameter='website_sale_address_management' |
||||
|
'.is_billing_city_is_required', |
||||
|
help="Specify whether billing city is required") |
||||
|
billing_country_id = fields.Many2one('res.country', |
||||
|
config_parameter='billing_country', |
||||
|
string="Default Billing Country", |
||||
|
help="Specify default billing country") |
||||
|
is_billing_zip_code = fields.Boolean( |
||||
|
string="Billing ZIP Code", |
||||
|
config_parameter='website_sale_address_management.is_billing_zip_code', |
||||
|
help="Enable or disable the option for billing ZIP code") |
||||
|
is_billing_zip_code_is_required = fields.Boolean( |
||||
|
string="Billing ZIP Code Is Required", |
||||
|
config_parameter='website_sale_address_management.' |
||||
|
'is_billing_zip_code_is_required', |
||||
|
help="Specify whether billing ZIP code is required") |
||||
|
is_shipping_phone = fields.Boolean( |
||||
|
string="Shipping Phone", |
||||
|
config_parameter='website_sale_address_management.is_shipping_phone', |
||||
|
help="Enable or disable the option for shipping phone") |
||||
|
is_shipping_phone_is_required = fields.Boolean( |
||||
|
string="Shipping Phone Is Required", |
||||
|
config_parameter='website_sale_address_management.' |
||||
|
'is_shipping_phone_is_required', |
||||
|
help="Specify whether shipping phone is required") |
||||
|
is_shipping_street = fields.Boolean( |
||||
|
string="Shipping Street", |
||||
|
config_parameter='website_sale_address_management.is_shipping_street', |
||||
|
help="Enable or disable the option for shipping street") |
||||
|
is_shipping_street_is_required = fields.Boolean( |
||||
|
string="Shipping Street Is Required", |
||||
|
config_parameter='website_sale_address_management.' |
||||
|
'is_shipping_street_is_required', |
||||
|
help="Specify whether shipping street is required") |
||||
|
is_shipping_street2 = fields.Boolean( |
||||
|
string="Shipping Street 2", |
||||
|
config_parameter='website_sale_address_management.is_shipping_street2', |
||||
|
help="Enable or disable the option for shipping street 2") |
||||
|
is_shipping_city = fields.Boolean( |
||||
|
string="Shipping City", |
||||
|
config_parameter='website_sale_address_management.is_shipping_city', |
||||
|
help="Enable or disable the option for shipping city") |
||||
|
is_shipping_city_is_required = fields.Boolean( |
||||
|
string="Shipping City Is Required", |
||||
|
config_parameter='website_sale_address_management.' |
||||
|
'is_shipping_city_is_required', |
||||
|
help="Specify whether shipping city is required") |
||||
|
shipping_country_id = fields.Many2one('res.country', |
||||
|
config_parameter='shipping_country', |
||||
|
string="Default Shipping Country", |
||||
|
help="Specify the default " |
||||
|
"shipping country") |
||||
|
is_shipping_zip_code = fields.Boolean( |
||||
|
string="Shipping ZIP Code", |
||||
|
config_parameter='website_sale_address_management.is_shipping_zip_code', |
||||
|
help="Enable or disable the option for shipping ZIP code") |
||||
|
is_shipping_zip_code_is_required = fields.Boolean( |
||||
|
string="Shipping ZIP Code Is Required", |
||||
|
config_parameter='website_sale_address_management.' |
||||
|
'is_shipping_zip_code_is_required', |
||||
|
help="Specify whether shipping ZIP code is required") |
||||
|
|
||||
|
@api.onchange('is_billing_phone', 'is_billing_street', |
||||
|
'is_billing_city', 'is_billing_zip_code', 'is_shipping_phone', |
||||
|
'is_shipping_street', 'is_shipping_city', |
||||
|
'is_shipping_zip_code') |
||||
|
def _onchange_fields(self): |
||||
|
"""This method is triggered when any of the specified fields |
||||
|
are changed. It updates the corresponding required fields based on |
||||
|
the user's input.""" |
||||
|
if not self.is_billing_phone: |
||||
|
self.is_billing_phone_is_required = False |
||||
|
if not self.is_billing_street: |
||||
|
self.is_billing_street_is_required = False |
||||
|
if not self.is_billing_city: |
||||
|
self.is_billing_city_is_required = False |
||||
|
if not self.is_billing_zip_code: |
||||
|
self.is_billing_zip_code_is_required = False |
||||
|
if not self.is_shipping_phone: |
||||
|
self.is_shipping_phone_is_required = False |
||||
|
if not self.is_shipping_street: |
||||
|
self.is_shipping_street_is_required = False |
||||
|
if not self.is_shipping_city: |
||||
|
self.is_shipping_city_is_required = False |
||||
|
if not self.is_shipping_zip_code: |
||||
|
self.is_shipping_zip_code_is_required = False |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 589 B |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 565 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 967 B |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 781 KiB |
After Width: | Height: | Size: 751 KiB |
After Width: | Height: | Size: 761 KiB |