[IMP] mail: allow users to give schedule and give a feedback on activities
When setting an activity as done in chatter users now have the possibility to add a feedback. This feedback is added in the generated message that already contains the activity name and note. Moreover users now can also immediately schedule a next activity. This is very useful for chained activities and speeds up activities use.
This commit is contained in:
committed by
Thibault Delavallée
parent
9c42c699f5
commit
63167fc51b
@@ -65,6 +65,7 @@ class MailActivity(models.Model):
|
||||
icon = fields.Char('Icon', related='activity_type_id.icon')
|
||||
summary = fields.Char('Summary')
|
||||
note = fields.Html('Note')
|
||||
feedback = fields.Html('Feedback')
|
||||
date_deadline = fields.Date('Deadline', index=True, required=True, default=fields.Date.today)
|
||||
# description
|
||||
user_id = fields.Many2one(
|
||||
@@ -117,8 +118,10 @@ class MailActivity(models.Model):
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def action_done(self):
|
||||
def action_done(self, feedback=False):
|
||||
message = self.env['mail.message']
|
||||
if feedback:
|
||||
self.write(dict(feedback=feedback))
|
||||
for activity in self:
|
||||
record = self.env[activity.res_model].browse(activity.res_id)
|
||||
record.message_post_with_view(
|
||||
|
||||
@@ -187,11 +187,49 @@ var Activity = form_common.AbstractField.extend({
|
||||
},
|
||||
|
||||
on_activity_done: function (event) {
|
||||
event.preventDefault();
|
||||
var self = this;
|
||||
var activity_id = this.$(event.currentTarget).data('activity-id');
|
||||
event.preventDefault();
|
||||
var $popover_el = this.$(event.currentTarget);
|
||||
var activity_id = $popover_el.data('activity-id');
|
||||
if(! $popover_el.data('bs.popover')) {
|
||||
$popover_el.popover({
|
||||
title : _t('Feedback'),
|
||||
html: 'true',
|
||||
trigger:'click',
|
||||
content : function() {
|
||||
var $popover = $(QWeb.render("mail.activity_feedback_form", {}));
|
||||
$popover.on('click', '.o_activity_popover_done_next', function (e) {
|
||||
self.set_done(activity_id, _.escape($popover.find('#activity_feedback').val()));
|
||||
self.on_activity_schedule(e);
|
||||
});
|
||||
$popover.on('click', '.o_activity_popover_done', function () {
|
||||
self.set_done(activity_id, _.escape($popover.find('#activity_feedback').val()));
|
||||
});
|
||||
$popover.on('click', '.o_activity_popover_discard', function () {
|
||||
$popover_el.popover('hide');
|
||||
});
|
||||
return $popover;
|
||||
},
|
||||
}).on("show.bs.popover", function (e) {
|
||||
$(".popover").not(e.target).popover("hide");
|
||||
}).on("shown.bs.popover", function () {
|
||||
var $popover = $(this).data("bs.popover").tip();
|
||||
$popover.css({maxWidth: "410px"}).attr('tabindex', 0);
|
||||
$popover.find('#activity_feedback').focus();
|
||||
// Outside click of popover hide the popover
|
||||
$popover.focusout(function (e) {
|
||||
if(!e.relatedTarget) {
|
||||
$popover.popover('hide');
|
||||
}
|
||||
});
|
||||
}).popover('show');
|
||||
}
|
||||
},
|
||||
|
||||
set_done: function (activity_id, feedback) {
|
||||
var self = this;
|
||||
this.Activity
|
||||
.call("action_done", [[activity_id]])
|
||||
.call("action_done", [[activity_id]], {'feedback': feedback})
|
||||
.then(function (msg_id) {
|
||||
self.fetch_and_render_value();
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="o_thread_message_sidebar">
|
||||
<img t-attf-src="/web/image/res.users/#{activity.user_id[0]}/image_small"
|
||||
class="o_thread_message_avatar mb8"/>
|
||||
<a href="#" class="o_activity_done o_activity_link" t-att-data-activity-id="activity.id"><span class="fa fa-check-circle fa-2x" /></a>
|
||||
<a href="#" class="o_activity_done o_activity_link" t-att-data-activity-id="activity.id" data-toggle="popover"><span class="fa fa-check-circle fa-2x" /></a>
|
||||
</div>
|
||||
<div class="o_thread_message_core o_mail_note">
|
||||
<div class="o_mail_info">
|
||||
@@ -41,4 +41,17 @@
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
<t t-name="mail.activity_feedback_form">
|
||||
<div>
|
||||
<textarea class="form-control" rows="3" id="activity_feedback" placeholder="Write Feedback"/>
|
||||
<div class="mt8">
|
||||
<button type="button" class="btn btn-xs btn-primary o_activity_popover_done_next">
|
||||
Done & Schedule Next</button>
|
||||
<button type="button" class="btn btn-xs btn-primary o_activity_popover_done">
|
||||
Done</button>
|
||||
<button type="button" class="btn btn-xs btn-link o_activity_popover_discard">
|
||||
Discard</button>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
@@ -61,6 +61,7 @@
|
||||
<span t-if="activity.summary" t-field="activity.summary"/>
|
||||
</p>
|
||||
<div t-field="activity.note"/>
|
||||
<div t-if="activity.feedback"><strong> Feedback : </strong><p t-field="activity.feedback"></p></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user