summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@openerp.com>2012-10-31 11:19:59 +0100
committerChristophe Matthieu <chm@openerp.com>2012-10-31 11:19:59 +0100
commited66b02fe67e714bf0a90e46cdafc742047cb3bc (patch)
tree0789560d238dafd736985d753543ea1c868cdc0a /addons/web/static/src
parent8597e63c29cf64815437aa1fd15604678c2db1b5 (diff)
[IMP] view form: add many2many_tag_email widget
bzr revid: chm@openerp.com-20121031101959-t4o6qusszamx5qgu
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/view_form.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 5ecad26e5df..a6fcd2c46cb 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -3955,6 +3955,41 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in
},
});
+
+/**
+ * Extend of FieldMany2ManyTags widget method.
+ * When the user add a partner and the partner don't have an email, open a popup to purpose to add an email.
+ * The user can choose to add an email or cancel and close the popup.
+ */
+instance.web.form.FieldMany2ManyTagsEmail = instance.web.form.FieldMany2ManyTags.extend({
+ add_id: function(id) {
+ this._super.apply(this, arguments);
+
+ var self = this;
+ new instance.web.Model('res.partner').call("read", [id, ["email"]], {context: this.build_context()}).pipe(function (dict) {
+ if (!dict.email) {
+ if (! confirm(_t("This partner don't have email.\nDo you want to complete the partner's informations?"))) { return false; }
+ self.on_complete_informations(dict);
+ }
+ });
+ },
+
+ on_complete_informations: function (dict) {
+ var self = this;
+
+ var pop = new instance.web.form.FormOpenPopup(self);
+ pop.show_element(
+ 'res.partner',
+ dict.id,
+ self.build_context(),
+ {
+ title: _t("Complete partner's informations"),
+ }
+ );
+ },
+
+});
+
/**
widget options:
- reload_on_button: Reload the whole form view if click on a button in a list view.
@@ -5141,6 +5176,7 @@ instance.web.form.widgets = new instance.web.Registry({
'many2one' : 'instance.web.form.FieldMany2One',
'many2many' : 'instance.web.form.FieldMany2Many',
'many2many_tags' : 'instance.web.form.FieldMany2ManyTags',
+ 'many2many_tags_email' : 'instance.web.form.FieldMany2ManyTagsEmail',
'many2many_kanban' : 'instance.web.form.FieldMany2ManyKanban',
'one2many' : 'instance.web.form.FieldOne2Many',
'one2many_list' : 'instance.web.form.FieldOne2Many',