[IMP] Removed the dialog box on apply and close to open a new dialog box everytime.

Removed unwanted code.

bzr revid: psa@tinyerp.com-20130315123157-n0n3fdej014ysz7v
This commit is contained in:
Paramjit Singh Sahota 2013-03-15 18:01:57 +05:30
parent 90868a8089
commit b5df63291a
3 changed files with 17 additions and 27 deletions

View File

@ -22,6 +22,7 @@
from openerp.osv import osv
from openerp.osv import fields
class mail_message_subtype(osv.osv):
""" Class holding subtype definition for messages. Subtypes allow to tune
the follower subscription, allowing only some subtypes to be pushed

View File

@ -162,7 +162,8 @@ class mail_thread(osv.AbstractModel):
res[fol.res_id]['message_subtype_data'] = thread_subtype_dict
return res
def apply_edited_subtypes(self, cr, uid, ids, partner_id,check_list, context=None):
def apply_edited_subtypes(self, cr, uid, ids, partner_id, check_list, context=None):
print "\n\n uid, ids, partner_id, check_list,,>", uid, ids, partner_id, check_list,
""" Apply the edited subtypes
of the user."""
fol_obj = self.pool.get('mail.followers')
@ -171,7 +172,8 @@ class mail_thread(osv.AbstractModel):
('res_id', 'in', ids),
('res_model', '=', self._name),
], context=context)
fol_obj.write(cr, uid, fol_ids, {'subtype_ids': [(6, 0, check_list)]}, context=context)
print "\n fol _ids>", fol_ids, check_list
fol_obj.write(cr, uid, fol_ids, {'subtype_ids': [(6,0, check_list)]}, context=context)
return True
def _search_message_unread(self, cr, uid, obj=None, name=None, domain=None, context=None):

View File

@ -31,7 +31,6 @@ openerp_mail_followers = function(session, mail) {
this.ds_model = new session.web.DataSetSearch(this, this.view.model);
this.ds_follow = new session.web.DataSetSearch(this, this.field.relation);
this.ds_users = new session.web.DataSetSearch(this, 'res.users');
this.check_access = false;
this.value = [];
this.followers = [];
@ -87,15 +86,15 @@ openerp_mail_followers = function(session, mail) {
var partner_name = $(event.target).siblings('a').text();
var id = this.view.datarecord.id;
var res_model = this.view.dataset.model;
var $dialog = session.web.dialog($('<div class = "oe_edit_actions">'), {
var $dialog = new session.web.dialog($('<div class = "oe_edit_actions">'), {
modal: true,
title: _t('Edit Subtypes of ') + '"' + partner_name + '"',
buttons: [
{ text: _t("Apply"), click: function() {
self.on_apply_subtype(id, partner_id);
$(this).dialog("close");
$dialog.remove();
}},
{ text: _t("Cancel"), click: function() { $(this).dialog("close"); }}
{ text: _t("Cancel"), click: function() { $dialog.remove(); }}
],
});
this.ds_model.call('edit_followers_subtype', [[id], partner_id, new session.web.CompoundContext(this.build_context(), {})])
@ -112,16 +111,17 @@ openerp_mail_followers = function(session, mail) {
},
on_apply_subtype: function(id, partner_id) {
var checklist = new Array();
_($('.oe_edit_actions input[type="checkbox"]')).each(function (record) {
if ($(record).is(':checked')) {
checklist.push(parseInt($(record).data('id')));
}
var check_list = new Array();
_($('.oe_edit_actions input[type="checkbox"]')).each(function (records) {
if ($(records).is(':checked')) {
check_list.push(parseInt($(records).data('id')));
}
});
if (!checklist.length) {
if (!check_list.length) {
this.do_unfollow();
} else {
this.ds_model.call('apply_edited_subtypes', [[id], partner_id, checklist, new session.web.CompoundContext(this.build_context(), {})])
return this.ds_model.call('apply_edited_subtypes', [[id], partner_id, check_list, new session.web.CompoundContext(this.build_context(), {})])
.then(this.proxy('read_value'));
}
},
@ -178,20 +178,7 @@ openerp_mail_followers = function(session, mail) {
return this.ds_follow.call('read', [this.value, ['name', 'user_ids']])
.then(this.proxy('display_followers'), this.proxy('fetch_generic'))
.then(this.proxy('display_buttons'))
.then(this.proxy('fetch_subtypes'))
.then(this.proxy('check_group_tech_feature'));
},
check_group_tech_feature: function() {
var self = this;
var edit_subtypes = new session.web.Model("res.groups");
edit_subtypes.query(["name","users"])
.filter([["name","=","Technical Features"], ["users","in",self.session.uid]]).first()
.then(function(res) {
if (res) {
self.check_access = true;
}
});
.then(this.proxy('fetch_subtypes'));
},
/** Read on res.partner failed: fall back on a generic case