Browse Source

[IMP] rename website_menu_display to website_menu_by_user_statuts

pull/429/head
Jordi Riera 5 years ago
parent
commit
ed79603157
9 changed files with 226 additions and 0 deletions
  1. +28
    -0
      website_menu_by_user_status/README.rst
  2. +22
    -0
      website_menu_by_user_status/__init__.py
  3. +44
    -0
      website_menu_by_user_status/__openerp__.py
  4. +34
    -0
      website_menu_by_user_status/i18n/website_menu_by_user_status.po
  5. +22
    -0
      website_menu_by_user_status/models/__init__.py
  6. +45
    -0
      website_menu_by_user_status/models/website_menu.py
  7. BIN
      website_menu_by_user_status/static/description/icon.png
  8. +15
    -0
      website_menu_by_user_status/views/website_templates.xml
  9. +16
    -0
      website_menu_by_user_status/views/website_views.xml

+ 28
- 0
website_menu_by_user_status/README.rst View File

@@ -0,0 +1,28 @@
Website Menu By User Status
===========================

The module manages display website menu entries, depending if the user is
logged or not.
The selection of the display status can be chosen logged and/or not.
Extends features and view of website.menu model.

Website.menu list view can be found at:
Settings > Configuration > Website Settings > Configure Website menus

The module inherit from website.menu to add 2 booleans fields, user_logged
and user_not_logged.
On top of that, website.layout template is extended to include a condition
that drive if the menu is built or not.
It has been choose to not only hide the menu to avoid to easily get around
by editing the html DOM.

Contributors
------------
* Bruno Joliveau <bruno.joliveau@savoirfairelinux.com>
* Jordi Riera <jordi.riera@savoirfairelinux.com>

More information
----------------
Module developed and tested with Odoo version 8.0
For questions, please contact our support services
<support@savoirfairelinux.com>

+ 22
- 0
website_menu_by_user_status/__init__.py View File

@@ -0,0 +1,22 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2010 - 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import models

+ 44
- 0
website_menu_by_user_status/__openerp__.py View File

@@ -0,0 +1,44 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

{
'name': 'Website Menu By User Display',
'version': '8.0.1.1.0',
'author': 'Savoir-faire Linux,Odoo Community Association (OCA)',
'website': 'http://www.savoirfairelinux.com',
'license': 'AGPL-3',
'category': 'Website',
'summary': 'Allow to manage the display of website.menus',
'depends': [
'website',
],
'external_dependencies': {
'python': [],
},
'data': [
'views/website_templates.xml',
'views/website_views.xml',
],
'demo': [],
'test': [],
'installable': True,
}

+ 34
- 0
website_menu_by_user_status/i18n/website_menu_by_user_status.po View File

@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_menu_by_user_status
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-02-02 14:37+0000\n"
"PO-Revision-Date: 2015-02-02 14:37+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: website_menu_by_user_status
#: code:addons/website_menu_by_user_status/models/website_menu.py:36
#, python-format
msgid "If checked, the menu will be displayed when the user is logged."
msgstr ""

#. module: website_menu_by_user_status
#: code:addons/website_menu_by_user_status/models/website_menu.py:43
#, python-format
msgid "If checked, the menu will be displayed when the user is not logged."
msgstr ""

#. module: website_menu_by_user_status
#: model:ir.model,name:website_menu_by_user_status.model_website_menu
msgid "Website Menu"
msgstr ""


+ 22
- 0
website_menu_by_user_status/models/__init__.py View File

@@ -0,0 +1,22 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2010 - 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import website_menu

+ 45
- 0
website_menu_by_user_status/models/website_menu.py View File

@@ -0,0 +1,45 @@
# -*- encoding: utf-8 -*-
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

import logging
_logger = logging.getLogger(__name__)
from openerp import models, fields
from openerp.tools.translate import _


class WebsiteMenu(models.Model):
"""Improve website.menu with adding booleans that drive
if the menu is displayed when the user is logger or not.
"""
_inherit = 'website.menu'

user_logged = fields.Boolean(
string="User Logged",
default=True,
help=_("If checked, "
"the menu will be displayed when the user is logged.")
)

user_not_logged = fields.Boolean(
string="User Not Logged",
default=True,
help=_("If checked, "
"the menu will be displayed when the user is not logged.")
)

BIN
website_menu_by_user_status/static/description/icon.png View File

Before After
Width: 80  |  Height: 80  |  Size: 7.3KB

+ 15
- 0
website_menu_by_user_status/views/website_templates.xml View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="website_display_menu" name="Conditional display menu"
inherit_id="website.layout"
active="True" customize_show="True">
<xpath expr="//ul[@id='top_menu']/t/t" position="replace">
<t t-if="(submenu.user_logged and request.uid != %(base.public_user)d) or (submenu.user_not_logged and request.uid == %(base.public_user)d)">
<t t-call="website.submenu"/>
</t>
</xpath>

</template>
</data>
</openerp>

+ 16
- 0
website_menu_by_user_status/views/website_views.xml View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="website_menu_display" model="ir.ui.view">
<field name="name">Website.menu: Display to user booleans</field>
<field name="model">website.menu</field>
<field name="inherit_id" ref="website.menu_tree"/>
<field name="arch" type="xml">
<field name="new_window" position="after">
<field name="user_logged"/>
<field name="user_not_logged"/>
</field>
</field>
</record>
</data>
</openerp>

Loading…
Cancel
Save