[ADD]: Make url for invitation
-> When session validate do_accept/do_reject -> Make post in chatter accept/reject -> Show calender view. bzr revid: aja@tinyerp.com-20130627104206-t8eyclekx3f9mmia
This commit is contained in:
parent
61292a1782
commit
899a60b616
|
@ -21,6 +21,6 @@
|
||||||
|
|
||||||
import base_calendar
|
import base_calendar
|
||||||
import crm_meeting
|
import crm_meeting
|
||||||
import service
|
import controllers
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -404,25 +404,17 @@ property or property parameter."),
|
||||||
attendee_add.value = 'MAILTO:' + (attendee.email or '')
|
attendee_add.value = 'MAILTO:' + (attendee.email or '')
|
||||||
res = cal.serialize()
|
res = cal.serialize()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def meeting_invitation(self, cr, uid, ids,context=None):
|
def meeting_invitation(self, cr, uid, ids,context=None):
|
||||||
partner_obj = self.browse(cr,uid, ids,context=context)
|
partner_obj = self.browse(cr,uid, ids,context=context)
|
||||||
for event_id in self.browse(cr, uid, ids, context):
|
action_id=self.pool.get('ir.actions.act_window').search(cr, uid, [('res_model','=','crm.meeting')], context=context)
|
||||||
event_id = event_id.ref.id
|
base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='http://localhost:8069', context=context)
|
||||||
for partner in partner_obj:
|
for partner in partner_obj:
|
||||||
if partner and partner.user_id:
|
if partner and partner.ref.user_id:
|
||||||
related_user = partner.user_id
|
base_url += '/meeting/meeting_invitation?db=%s&debug=&token=%s&action=%s' % (cr.dbname, ids[0],action_id[0]);
|
||||||
base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url')
|
|
||||||
query = {'db': cr.dbname}
|
|
||||||
fragment = {
|
|
||||||
'login': related_user.login,
|
|
||||||
'model': "crm.meeting",
|
|
||||||
'view_type' : "form",
|
|
||||||
'res_id': event_id,
|
|
||||||
}
|
|
||||||
url = urljoin(base_url, "?%s#%s" % (urlencode(query), urlencode(fragment)))
|
|
||||||
else :
|
else :
|
||||||
url = "https://openerp.my.openerp.com/#"
|
base_url += "/auth_signup"
|
||||||
return url
|
return base_url
|
||||||
|
|
||||||
def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context=None):
|
def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context=None):
|
||||||
"""
|
"""
|
||||||
|
@ -532,15 +524,16 @@ property or property parameter."),
|
||||||
"""
|
"""
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
|
meeting_obj = self.pool.get('crm.meeting')
|
||||||
for vals in self.browse(cr, uid, ids, context=context):
|
for vals in self.browse(cr, uid, ids, context=context):
|
||||||
if vals.ref and vals.ref.user_id:
|
if vals.ref and vals.ref.user_id:
|
||||||
mod_obj = self.pool[vals.ref._name]
|
mod_obj = self.pool[vals.ref._name]
|
||||||
res=mod_obj.read(cr,uid,[vals.ref.id],['duration','class'],context)
|
res=mod_obj.read(cr,uid,[vals.ref.id],['duration','class'],context)
|
||||||
defaults = {'user_id': vals.user_id.id, 'organizer_id': vals.ref.user_id.id,'duration':res[0]['duration'],'class':res[0]['class']}
|
defaults = {'user_id': vals.user_id.id, 'organizer_id': vals.ref.user_id.id,'duration':res[0]['duration'],'class':res[0]['class']}
|
||||||
mod_obj.copy(cr, uid, vals.ref.id, default=defaults, context=context)
|
# mod_obj.copy(cr, uid, vals.ref.id, default=defaults, context=context)
|
||||||
|
meeting_id = meeting_obj.search(cr, uid, [('attendee_ids','=',vals.id)],context = context)
|
||||||
|
meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s has Accept the meeting") % (vals.cn)), context=context)
|
||||||
self.write(cr, uid, vals.id, {'state': 'accepted'}, context)
|
self.write(cr, uid, vals.id, {'state': 'accepted'}, context)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def do_decline(self, cr, uid, ids, context=None, *args):
|
def do_decline(self, cr, uid, ids, context=None, *args):
|
||||||
|
@ -555,6 +548,10 @@ property or property parameter."),
|
||||||
"""
|
"""
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
|
meeting_obj = self.pool.get('crm.meeting')
|
||||||
|
vals=self.browse(cr, uid, ids, context=context)[0]
|
||||||
|
meeting_id = meeting_obj.search(cr, uid, [('attendee_ids','=',vals.id)],context = context)
|
||||||
|
meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s has Reject the meeting") % (vals.cn)), context=context)
|
||||||
return self.write(cr, uid, ids, {'state': 'declined'}, context)
|
return self.write(cr, uid, ids, {'state': 'declined'}, context)
|
||||||
|
|
||||||
def create(self, cr, uid, vals, context=None):
|
def create(self, cr, uid, vals, context=None):
|
||||||
|
|
|
@ -177,7 +177,7 @@
|
||||||
<td colspan="3"><div style = " font-family: Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 10px" > You, %(organizer)s <span style= "color:#A9A9A9; ont-size: 9px">- Organizer </br></span>%(attendees)s</div> </td> </tr>
|
<td colspan="3"><div style = " font-family: Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 10px" > You, %(organizer)s <span style= "color:#A9A9A9; ont-size: 9px">- Organizer </br></span>%(attendees)s</div> </td> </tr>
|
||||||
</table></td></tr>
|
</table></td></tr>
|
||||||
<tr >
|
<tr >
|
||||||
<td><div style = " font-family: Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 10px" ><span style= "margin-top: 50px; margin-left: 200px;" ><a href="%(url)s">Accept</a> | <a href="%(url)s">Decline</a></span></div> </td>
|
<td><div style = " font-family: Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 10px" ><span style= "margin-top: 50px; margin-left: 200px;" ><a href="%(url)s&status=accepted">Accept</a> | <a href="%(url)s&status=declined">Decline</a></span></div> </td>
|
||||||
<tr>
|
<tr>
|
||||||
<td><div > -- </br> Sent by %(responsible)s from %(company)s.View this meeting detail <a href="%(url)s">directly in OpenERP</a></div> </td>
|
<td><div > -- </br> Sent by %(responsible)s from %(company)s.View this meeting detail <a href="%(url)s">directly in OpenERP</a></div> </td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
import main
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,22 @@
|
||||||
|
import simplejson
|
||||||
|
import urllib
|
||||||
|
import openerp.addons.web.http as oeweb
|
||||||
|
import openerp.addons.web.controllers.main as webmain
|
||||||
|
|
||||||
|
class crm_meetting_importstatus(oeweb.Controller):
|
||||||
|
_cp_path = '/meeting'
|
||||||
|
|
||||||
|
@oeweb.httprequest
|
||||||
|
def meeting_invitation(self, req, db, token, action, status):
|
||||||
|
print 'FFFFFFFFFFFFF'
|
||||||
|
js = "\n ".join('<script type="text/javascript" src="%s"></script>' % i for i in webmain.manifest_list(req,'js', db=db))
|
||||||
|
css = "\n ".join('<link rel="stylesheet" href="%s">' % i for i in webmain.manifest_list(req,'css',db=db))
|
||||||
|
|
||||||
|
return webmain.html_template % {
|
||||||
|
'js': js,
|
||||||
|
'css': css,
|
||||||
|
'modules': simplejson.dumps(webmain.module_boot(req, db)),
|
||||||
|
'init': 's.base_calendar.do_accept("%s","%s", "%s", "%s");'% (db,token,action,status),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,6 +181,10 @@
|
||||||
|
|
||||||
</notebook>
|
</notebook>
|
||||||
</sheet>
|
</sheet>
|
||||||
|
<div class="oe_chatter">
|
||||||
|
<field name="message_follower_ids" widget="mail_followers"/>
|
||||||
|
<field name="message_ids" widget="mail_thread"/>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
import simplejson
|
|
||||||
import openerp.addons.web.http as oeweb
|
|
||||||
import openerp.addons.web.controllers.main as webmain
|
|
||||||
|
|
||||||
class crm_meetting_importstatus(oeweb.Controller):
|
|
||||||
_cp_path = '/meeting'
|
|
||||||
@oeweb.httprequest
|
|
||||||
def meeting_invitation(self, req, db='may_29'):
|
|
||||||
return webmain.html_template % {
|
|
||||||
'js': "\n ".join('<script type="text/javascript" src="%s"></script>' % i for i in webmain.manifest_list(req, 'js',db= db)),
|
|
||||||
'css': "\n ".join('<link rel="stylesheet" href="%s">' % i for i in webmain.manifest_list(req, 'css', db=db)),
|
|
||||||
'modules': simplejson.dumps(webmain.module_boot(req, db)),
|
|
||||||
'init': 'var wc = new s.web.WebClient();wc.appendTo($(document.body)); s.base_calendar.meeting_invitation();'
|
|
||||||
}
|
|
|
@ -1,6 +1,69 @@
|
||||||
openerp.base_calendar = function(openerp) {
|
openerp.base_calendar = function(instance) {
|
||||||
|
var _t = instance.web._t;
|
||||||
openerp.base_calendar.meeting_invitation = function(){
|
instance.base_calendar = {}
|
||||||
console.log("daaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
||||||
}
|
instance.base_calendar.DoAccept = instance.web.Widget.extend({
|
||||||
|
|
||||||
|
init: function(parent,db,token,action,status) {
|
||||||
|
this._super();
|
||||||
|
this.db = db;
|
||||||
|
this.token = token;
|
||||||
|
this.status = status;
|
||||||
|
this.action = action;
|
||||||
|
this.ds_attendee = new instance.web.DataSetSearch(this, 'calendar.attendee');
|
||||||
|
},
|
||||||
|
start: function() {
|
||||||
|
var self = this;
|
||||||
|
if (instance.session.session_is_valid(self.db)) {
|
||||||
|
self.show_meeting();
|
||||||
|
} else {
|
||||||
|
self.show_login()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
show_login: function(action) {
|
||||||
|
var self = this;
|
||||||
|
this.destroy_content();
|
||||||
|
this.login = new instance.web.Login_extended(this,self.action);
|
||||||
|
this.login.appendTo(this.$el);
|
||||||
|
this.login.on('db_loaded',self,function(db,login){
|
||||||
|
if (instance.session.session_is_valid(db)) {
|
||||||
|
(self.show_meeting()).done(function(){
|
||||||
|
self.login.off('db_loaded');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
self.show_login();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
destroy_content: function() {
|
||||||
|
_.each(_.clone(this.getChildren()), function(el) {
|
||||||
|
el.destroy();
|
||||||
|
});
|
||||||
|
this.$el.children().remove();
|
||||||
|
},
|
||||||
|
show_meeting : function(){
|
||||||
|
var db = this.db;
|
||||||
|
var att_status = "do_decline";
|
||||||
|
var self = this;
|
||||||
|
if(self.status === 'accepted'){att_status = "do_accept";}
|
||||||
|
return this.ds_attendee.call(att_status,[[parseInt(this.token)]]).done(function(res){
|
||||||
|
location.replace(_.str.sprintf('/?db=%s&debug=#view_type=calendar&model=crm.meeting&action=%s',self.db,self.action));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
instance.web.Login_extended = instance.web.Login.extend({
|
||||||
|
do_login: function (db, login, password) {
|
||||||
|
var self = this;
|
||||||
|
(this._super.apply(this,arguments)).done(function(){
|
||||||
|
self.trigger('db_loaded',db,login)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
instance.base_calendar.do_accept = function (db, token, action, status) {
|
||||||
|
instance.session.session_bind(instance.session.origin).done(function () {
|
||||||
|
new instance.base_calendar.DoAccept(null,db,token,action,status).appendTo($("body").addClass('openerp'));
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
//vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
|
||||||
|
|
Loading…
Reference in New Issue