Browse Source

[ADD] website_portal: Restrict modif personal info

On the website portal, users must only be able to modify their phone and
postal address.
pull/38/head
Rémy Taymans 6 years ago
parent
commit
556f25dd3e
  1. 2
      beesdoo_website_portal/__init__.py
  2. 28
      beesdoo_website_portal/__openerp__.py
  3. 2
      beesdoo_website_portal/controllers/__init__.py
  4. 27
      beesdoo_website_portal/controllers/main.py
  5. 32
      beesdoo_website_portal/views/portal_website_templates.xml

2
beesdoo_website_portal/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf8 -*-
import controllers

28
beesdoo_website_portal/__openerp__.py

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Rémy Taymans <remytaymans@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'BEES coop Website Portal',
'description': """
Extension of the Website Portal that prevent modification of sensible data by the users
""",
'author': 'Rémy Taymans',
'license': 'AGPL-3',
'version': '9.0.1.0',
'website': "https://github.com/beescoop/Obeesdoo",
'category': 'Cooperative management',
'depends': [
'website',
'website_portal_extend',
],
'data': [
'views/portal_website_templates.xml',
]
}

2
beesdoo_website_portal/controllers/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import main

27
beesdoo_website_portal/controllers/main.py

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp.addons.website_portal_extend.controllers.main import ExtendWebsiteAccountController
class BeesdooAccountWebsiteController(ExtendWebsiteAccountController):
mandatory_billing_fields = [
"phone",
"city",
"country_id",
"street",
"zipcode",
]
optional_billing_fields = [
"state_id",
]
def _set_mandatory_fields(self, data):
"""This is not useful as the field 'company_name' is not present
anymore.
"""
pass

32
beesdoo_website_portal/views/portal_website_templates.xml

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Rémy Taymans <remytaymans@gmail.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<openerp>
<!-- Modifying the form -->
<template
id="beesdoo_website_portal_details_form"
name="Beesdoo Website Portal Details Form"
inherit_id="website_portal_extend.website_portal_details_form">
<xpath expr="//input[@name='name']/.." position="before">
<div class="col-md-12">
<div class="alert alert-info">
<strong>Info !</strong>
To modify information that is not present in this form,
please contact us.
</div>
</div>
</xpath>
<xpath expr="//input[@name='name']/.." position="replace">
</xpath>
<xpath expr="//input[@name='email']/.." position="replace">
</xpath>
<xpath expr="//input[@name='company_name']/.." position="replace">
</xpath>
<xpath expr="//input[@name='vat']/.." position="replace">
</xpath>
</template>
</openerp>
Loading…
Cancel
Save