[ADD]: Module portal_calender : Allow an anonymous and portal user to see meetings

bzr revid: aja@tinyerp.com-20131001132115-co24ucbc84b7sn1e
This commit is contained in:
ajay javiya (OpenERP)
2013-10-01 18:51:15 +05:30
parent c01f6cd477
commit 6cc461a352
7 changed files with 113 additions and 6 deletions
@@ -10,6 +10,7 @@
<field ref="model_crm_meeting" name="model_id"/>
<field eval="1" name="personal"/>
<field name="domain_force">['|',('attendee_ids.partner_id','=',user.partner_id.id),('attendee_ids','=',False)]</field>
<field name="groups" eval="[(4, ref('base.group_user'))]"/>
</record>
</data>
</openerp>
@@ -16,10 +16,10 @@ instance.base_calendar = {}
},
start: function() {
var self = this;
if (instance.session.session_is_valid(self.db)) {
if (instance.session.session_is_valid(self.db) && (this.view_type == 'calendar' || this.view_type == 'form' && this.session.username != 'anonymous')) {
self.show_meeting();
} else {
self.show_login()
}else {
self.show_login();
}
},
show_login: function(action) {
@@ -46,7 +46,7 @@ instance.base_calendar = {}
},
show_meeting : function(){
var db = this.db;
var att_status = "do_decline";
var att_status = false;
var self = this;
var reload_page = function(){
if(self.view_type === 'form'){
@@ -56,11 +56,16 @@ instance.base_calendar = {}
return location.replace(_.str.sprintf('/?db=%s#view_type=%s&model=crm.meeting&action=%s',self.db,self.view_type,self.action));
}
}
if(self.status === 'accepted'){att_status = "do_accept";}
if(self.status === 'accepted'){
att_status = "do_accept";
}
else if(self.status === 'declined'){
att_status === "do_decline";
}
var calender_attendee = new instance.web.Model('calendar.attendee')
return calender_attendee.get_func("search_read")([["id", "=", parseInt(this.token)]],['state']).done(function(res){
if(res[0] && res[0]['state'] === "needs-action"){
if(res[0] && res[0]['state'] === "needs-action" && att_status){
return calender_attendee.call(att_status,[[parseInt(self.token)]]).done(reload_page);
}
reload_page();
+20
View File
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP SA (<http://www.openerp.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/>.
#
##############################################################################
+46
View File
@@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP SA (<http://www.openerp.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': 'Portal Calender',
'version': '0.1',
'category': 'Tools',
'complexity': 'easy',
'description': """
This module adds Calendar menu and features to your portal if Calendar and portal are installed.
==========================================================================================
""",
'author': 'OpenERP SA',
'depends': [
'base_calendar',
'portal',
],
'data': [
'portal_calender_view.xml',
'security/portal_security.xml',
'security/ir.model.access.csv',
],
'installable': True,
'auto_install': True,
'category': 'Hidden',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!--
Override the original action to set another help field and/or
another context field, more suited for portal members
-->
<record model="ir.actions.act_window" id="action_portal_meeting_view">
<field name="name">Meetings</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">crm.meeting</field>
<field name="view_mode">calendar,tree,form</field>
<field name="help">There are no public meeting.</field>
</record>
<menuitem name="Calendar" id="portal_company_meeting" parent="portal.portal_company"
action="action_portal_meeting_view" sequence="30"/>
</data>
</openerp>
@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_meeting,meeting,base_calendar.model_crm_meeting,portal.group_portal,1,0,0,0
access_anonymous_meeting,meeting,base_calendar.model_crm_meeting,portal.group_anonymous,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_meeting meeting base_calendar.model_crm_meeting portal.group_portal 1 0 0 0
3 access_anonymous_meeting meeting base_calendar.model_crm_meeting portal.group_anonymous 1 0 0 0
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.rule" id="crm_meeting_portal_anonymous_rule">
<field name="name">Meeting: portal and anonymous users: public only</field>
<field name="model_id" ref="crm.model_crm_meeting"/>
<field name="domain_force">[('class', '=', 'public')]</field>
<field name="groups" eval="[(4, ref('portal.group_portal')), (4, ref('portal.group_anonymous'))]"/>
</record>
</data>
</openerp>