[ADD]:widget for invitation status on many2many field , will see the status of attendee if accepted then green, declined then red otherwise grey buttton
[IMP]: onclick accept/decline open form view of meeting and if click on direct to openerp will open calneder view of meeting -> Message in chatter when accept/decline. bzr revid: aja@tinyerp.com-20130711113624-baqko9b4b1fjoh8o
This commit is contained in:
parent
05544e1522
commit
6b91bc24d7
|
@ -50,6 +50,10 @@ If you need to manage your meetings, you should install the CRM module.
|
|||
'js': [
|
||||
'static/src/js/*.js'
|
||||
],
|
||||
'qweb': ['static/src/xml/*.xml'],
|
||||
'css': [
|
||||
'static/src/css/base_calender.css'
|
||||
],
|
||||
'test' : ['test/base_calendar_test.yml'],
|
||||
'installable': True,
|
||||
'application': True,
|
||||
|
|
|
@ -450,7 +450,7 @@ property or property parameter."),
|
|||
'responsible': res_obj.user_id and res_obj.user_id.name or 'OpenERP User',
|
||||
'company': company,
|
||||
'description': res_obj.description or '-',
|
||||
'attendees': ', ' .join(att_info),
|
||||
'attendees': ',\n' .join(att_info),
|
||||
'time': time,
|
||||
'tz': tz,
|
||||
'location': res_obj.location or '-',
|
||||
|
@ -518,8 +518,8 @@ property or property parameter."),
|
|||
meeting_obj = self.pool.get('crm.meeting')
|
||||
for vals in self.browse(cr, uid, ids, context=context):
|
||||
meeting_id = meeting_obj.search(cr, uid, [('attendee_ids','=',vals.id)],context = context)
|
||||
if meeting_id:
|
||||
meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s Accept Invitation") % (vals.cn)), context=context)
|
||||
if meeting_id and vals.state != 'accepted':
|
||||
meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s has Accept Invitation") % (vals.cn)), context=context)
|
||||
self.write(cr, uid, vals.id, {'state': 'accepted'}, context)
|
||||
return True
|
||||
|
||||
|
@ -538,8 +538,8 @@ property or property parameter."),
|
|||
meeting_obj = self.pool.get('crm.meeting')
|
||||
for vals in self.browse(cr, uid, ids, context=context):
|
||||
meeting_id = meeting_obj.search(cr, uid, [('attendee_ids','=',vals.id)],context = context)
|
||||
if meeting_id:
|
||||
meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s Reject Invitation") % (vals.cn)), context=context)
|
||||
if meeting_id and vals.state != 'declined':
|
||||
meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s has Declined Invitation") % (vals.cn)), context=context)
|
||||
self.write(cr, uid, vals.id, {'state': 'declined'}, context)
|
||||
return True
|
||||
|
||||
|
|
|
@ -177,9 +177,9 @@
|
|||
<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>
|
||||
<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&view_type=calendar&status=accepted">Accept</a> | <a href="%(url)s&view_type=calendar&status=declined">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&view_type=form&status=accepted">Accept</a> | <a href="%(url)s&view_type=form&status=declined">Decline</a></span></div> </td>
|
||||
<tr>
|
||||
<td><div > -- </br> Sent by %(responsible)s from %(company)s.View this meeting detail <a href="%(url)s&view_type=form&status=">directly in OpenERP</a></div> </td>
|
||||
<td><div > -- </br> Sent by %(responsible)s from %(company)s.View this meeting detail <a href="%(url)s&view_type=calendar&status=">directly in OpenERP</a></div> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
</h1>
|
||||
<label for="partner_ids" class="oe_edit_only"/>
|
||||
<h2>
|
||||
<field name="partner_ids" widget="many2many_tags"
|
||||
<field name="partner_ids" widget="Many2Many_invite"
|
||||
context="{'force_email':True}"
|
||||
on_change="onchange_partner_ids(partner_ids)"/>
|
||||
</h2>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
.openerp .oe_invitation , .text-core .text-tag .oe_invitation{
|
||||
width : 16px;
|
||||
height : 16px;
|
||||
margin-bottom : -4px;
|
||||
display : inline-block;
|
||||
}
|
||||
.openerp .needs-action , .tentative,.text-core .text-tag .custom-edit, .text-core .text-tag .tentative {
|
||||
background : url(/web/static/src/img/icons/gtk-normal.png) no-repeat;
|
||||
}
|
||||
.openerp .accepted , .text-core .text-tag .accepted {
|
||||
background : url(/web/static/src/img/icons/gtk-yes.png) no-repeat;
|
||||
}
|
||||
.openerp .declined , .text-core .text-tag .declined {
|
||||
background : url(/web/static/src/img/icons/gtk-no.png) no-repeat;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
openerp.base_calendar = function(instance) {
|
||||
var _t = instance.web._t;
|
||||
var QWeb = instance.web.qweb;
|
||||
instance.base_calendar = {}
|
||||
|
||||
instance.base_calendar.invite = instance.web.Widget.extend({
|
||||
|
@ -49,7 +50,7 @@ instance.base_calendar = {}
|
|||
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=%s&model=crm.meeting&action=%s&active_id=%s',self.db,self.view_type,self.action,self.token));
|
||||
location.replace(_.str.sprintf('/?db=%s#view_type=%s&model=crm.meeting&action=%s&id=%s',self.db,self.view_type,self.action,self.token));
|
||||
});
|
||||
},
|
||||
});
|
||||
|
@ -61,6 +62,134 @@ instance.base_calendar = {}
|
|||
});
|
||||
}
|
||||
});
|
||||
instance.web.form.Many2Many_invite = instance.web.form.FieldMany2ManyTags.extend({
|
||||
initialize_content: function() {
|
||||
var self = this;
|
||||
var ignore_blur = false;
|
||||
self.$text = this.$("textarea");
|
||||
if (this.get("effective_readonly"))
|
||||
return;
|
||||
self.$text.textext({
|
||||
plugins : 'tags arrow autocomplete',
|
||||
html: {
|
||||
tag: '<div class="text-tag"><div class="text-button"><a class="oe_invitation custom-edit"/><span class="text-label"/><a class="text-remove"/></div></div>'
|
||||
},
|
||||
autocomplete: {
|
||||
render: function(suggestion) {
|
||||
return $('<span class="text-label"/>').
|
||||
data('index', suggestion['index']).html(suggestion['label']);
|
||||
}
|
||||
},
|
||||
ext: {
|
||||
autocomplete: {
|
||||
selectFromDropdown: function() {
|
||||
this.trigger('hideDropdown');
|
||||
var index = Number(this.selectedSuggestionElement().children().children().data('index'));
|
||||
var data = self.search_result[index];
|
||||
if (data.id) {
|
||||
self.add_id(data.id);
|
||||
} else {
|
||||
ignore_blur = true;
|
||||
data.action();
|
||||
}
|
||||
this.trigger('setSuggestions', {result : []});
|
||||
},
|
||||
},
|
||||
tags: {
|
||||
isTagAllowed: function(tag) {
|
||||
return !!tag.name;
|
||||
|
||||
},
|
||||
removeTag: function(tag) {
|
||||
var id = tag.data("id");
|
||||
self.set({"value": _.without(self.get("value"), id)});
|
||||
},
|
||||
renderTag: function(stuff) {
|
||||
return $.fn.textext.TextExtTags.prototype.renderTag.
|
||||
call(this, stuff).data("id", stuff.id);
|
||||
},
|
||||
},
|
||||
itemManager: {
|
||||
itemToString: function(item) {
|
||||
return item.name;
|
||||
},
|
||||
},
|
||||
core: {
|
||||
onSetInputData: function(e, data) {
|
||||
if (data == '') {
|
||||
this._plugins.autocomplete._suggestions = null;
|
||||
}
|
||||
this.input().val(data);
|
||||
},
|
||||
},
|
||||
},
|
||||
}).bind('getSuggestions', function(e, data) {
|
||||
var _this = this;
|
||||
var str = !!data ? data.query || '' : '';
|
||||
self.get_search_result(str).done(function(result) {
|
||||
self.search_result = result;
|
||||
$(_this).trigger('setSuggestions', {result : _.map(result, function(el, i) {
|
||||
return _.extend(el, {index:i});
|
||||
})});
|
||||
});
|
||||
}).bind('hideDropdown', function() {
|
||||
self._drop_shown = false;
|
||||
}).bind('showDropdown', function() {
|
||||
self._drop_shown = true;
|
||||
});
|
||||
self.tags = self.$text.textext()[0].tags();
|
||||
self.$text
|
||||
.focusin(function () {
|
||||
self.trigger('focused');
|
||||
ignore_blur = false;
|
||||
})
|
||||
.focusout(function() {
|
||||
self.$text.trigger("setInputData", "");
|
||||
if (!ignore_blur) {
|
||||
self.trigger('blurred');
|
||||
}
|
||||
}).keydown(function(e) {
|
||||
if (e.which === $.ui.keyCode.TAB && self._drop_shown) {
|
||||
self.$text.textext()[0].autocomplete().selectFromDropdown();
|
||||
}
|
||||
});
|
||||
},
|
||||
render_value: function() {
|
||||
var self = this;
|
||||
var dataset = new instance.web.DataSetStatic(this, this.field.relation, self.build_context());
|
||||
var values = self.get("value");
|
||||
var handle_names = function(data) {
|
||||
if (self.isDestroyed())
|
||||
return;
|
||||
if (! self.get("effective_readonly")) {
|
||||
self.tags.containerElement().children().remove();
|
||||
self.$('textarea').css("padding-left", "3px");
|
||||
self.tags.addTags(_.map(data, function(el) {return {name: el[1], id:el[0]};}));
|
||||
var tag_element = self.tags.tagElements();
|
||||
_.each(data,function(value, key){
|
||||
$(tag_element[key]).find(".custom-edit").addClass(data[key][2])
|
||||
})
|
||||
} else {
|
||||
self.$el.html(QWeb.render("Many2Many_invite", {elements: data}));
|
||||
}
|
||||
};
|
||||
if (! values || values.length > 0) {
|
||||
if(self.getParent().datarecord.attendee_ids){
|
||||
return new instance.web.Model("calendar.attendee").call('read',[self.getParent().datarecord.attendee_ids ,['state','cn','partner_id']]).then(function(res){
|
||||
data = []
|
||||
_.each(res,function(val){
|
||||
data.push([val['partner_id'][0],val['cn'],val['state']])
|
||||
});
|
||||
handle_names(data)
|
||||
});
|
||||
} else { this._display_orderer.add(dataset.name_get(values)).done(handle_names); }
|
||||
} else { handle_names([]); }
|
||||
},
|
||||
|
||||
});
|
||||
instance.web.form.widgets = instance.web.form.widgets.extend({
|
||||
'Many2Many_invite' : 'instance.web.form.Many2Many_invite',
|
||||
});
|
||||
instance.base_calendar.event = function (db, token, action, view_type, status) {
|
||||
instance.session.session_bind(instance.session.origin).done(function () {
|
||||
new instance.base_calendar.invite(null,db,token,action,view_type,status).appendTo($("body").addClass('openerp'));
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<template>
|
||||
<t t-name="Many2Many_invite" >
|
||||
<t t-set="i" t-value="0"/>
|
||||
<t t-foreach="elements" t-as="el">
|
||||
<span class="oe_tag" t-att-data-index="i">
|
||||
<a t-attf-class="oe_invitation #{el[2]}"/>
|
||||
<t t-esc="el[1]"/>
|
||||
</span>
|
||||
<t t-set="i" t-value="i + 1"/>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
Loading…
Reference in New Issue