[ADD] the possibility to show or hide events in the portal

bzr revid: abo@openerp.com-20120727145337-69ey9rcb070kaatj
This commit is contained in:
Antonin Bourguignon 2012-07-27 16:53:37 +02:00
parent f90f7460bf
commit 3bbc7e0efc
4 changed files with 64 additions and 0 deletions

View File

@ -22,6 +22,7 @@
import portal
import wizard
import res_user
import event
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -39,6 +39,7 @@ very handy when used in combination with the module 'share'.
""",
'website': 'http://www.openerp.com',
'data': [
'event_view.xml',
'security/portal_security.xml',
'security/ir.model.access.csv',
'portal_view.xml',

39
addons/portal/event.py Normal file
View File

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 osv import osv, fields
class event_event(osv.osv):
_description = "Portal event"
_inherit = 'event.event'
"""
``visibility``: defines if the employee appears on the portal's contact page
- 'public' means the event will appear for everyone (anonymous)
- 'private' means the event won't appear
"""
_columns = {
'visibility': fields.selection([('public', 'Public'),('private', 'Private')],
string='Visibility', help='Event\'s visibility in the portal\'s contact page'),
}
_defaults = {
'visibility': 'private',
}

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- add visibility field to the event form view -->
<record id="view_employee_form" model="ir.ui.view">
<field name="name">portal.event.form</field>
<field name="model">event.event</field>
<field name="type">form</field>
<field name="inherit_id" ref="event.view_event_form"/>
<field name="arch" type="xml">
<xpath expr="//page[last()]" position="after">
<page string="Portal Settings">
<group>
<field name="visibility"/>
</group>
</page>
</xpath>
</field>
</record>
</data>
</openerp>