diff --git a/beesdoo_website_portal/__manifest__.py b/beesdoo_website_portal/__manifest__.py index f3e33ec..26e3d3a 100644 --- a/beesdoo_website_portal/__manifest__.py +++ b/beesdoo_website_portal/__manifest__.py @@ -4,8 +4,8 @@ { 'name': 'BEES coop Website Portal', - 'description': """ - Extension of the Website Portal that prevent modification of sensible data by the users + 'summary': """ + Extension of the Portal that prevent modification of sensible data by the users """, 'author': 'Coop IT Easy SCRLfs', 'license': 'AGPL-3', @@ -13,8 +13,8 @@ 'website': "https://www.coopiteasy.be", 'category': 'Cooperative management', 'depends': [ - 'website', - 'website_portal_extend', + 'portal', + 'website' ], 'data': [ 'views/portal_website_templates.xml', diff --git a/beesdoo_website_portal/controllers/main.py b/beesdoo_website_portal/controllers/main.py index 3477f58..c221bb3 100644 --- a/beesdoo_website_portal/controllers/main.py +++ b/beesdoo_website_portal/controllers/main.py @@ -3,25 +3,32 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo.addons.website_portal_extend.controllers.main import ExtendWebsiteAccountController -from odoo.http import request +from odoo.addons.portal.controllers.portal import CustomerPortal -class BeesdooAccountWebsiteController(ExtendWebsiteAccountController): - - mandatory_billing_fields = [ - "phone", +class BeesdooAccountWebsiteController(CustomerPortal): + # override from `portal` module + CustomerPortal.MANDATORY_BILLING_FIELDS = [ "city", "country_id", + "phone", "street", "zipcode", ] - optional_billing_fields = [ - "state_id", - ] + CustomerPortal.OPTIONAL_BILLING_FIELDS = ["state_id"] + + def details_form_validate(self, data): + error, error_message = super().details_form_validate(data) + + # since we override mandatory and optional billing fields, + # parent method will insert the following key/value in `error` dict and `error_message` list, + # preventing from saving the form. Workaround is to clear both dict and list. + if ( + error.get("common") + and error["common"] == "Unknown field" + and "Unknown field 'name,email,company_name,vat'" in error_message + ): + error.pop("common") + error_message.remove("Unknown field 'name,email,company_name,vat'") - def _set_mandatory_fields(self, data): - """This is not useful as the field 'company_name' is not present - anymore. - """ - pass + return error, error_message diff --git a/beesdoo_website_portal/views/portal_website_templates.xml b/beesdoo_website_portal/views/portal_website_templates.xml index 2fa6201..721235d 100644 --- a/beesdoo_website_portal/views/portal_website_templates.xml +++ b/beesdoo_website_portal/views/portal_website_templates.xml @@ -5,28 +5,31 @@ --> - - + +