Vishmita Jadeja (openerp) has proposed merging 
lp:~openerp-dev/openerp-web/trunk-m2o_tooltip-vja into lp:openerp-web.

Requested reviews:
  OpenERP R&D Web Team (openerp-dev-web)

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-m2o_tooltip-vja/+merge/97794


-Add Tooltip for Many2One field using tipsy library.
-Remove Context Menu form Many2One Field.
-Remove Invalid class after select value form drop-down.
-- 
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-m2o_tooltip-vja/+merge/97794
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-web/trunk-m2o_tooltip-vja.
=== modified file 'addons/web/static/lib/jquery.tipsy/tipsy.css'
--- addons/web/static/lib/jquery.tipsy/tipsy.css	2012-01-26 13:24:41 +0000
+++ addons/web/static/lib/jquery.tipsy/tipsy.css	2012-03-16 04:23:20 +0000
@@ -1,4 +1,4 @@
-.tipsy { font-size: 90%; position: absolute; padding: 5px; z-index: 100000; }
+.tipsy { font-size: 90%; position: absolute; padding: 5px; z-index: 1000; }
   .tipsy-inner { background-color: #000; color: #FFF; max-width: 500px; padding: 5px 8px 4px 8px; }
 
   /* Rounded corners */

=== modified file 'addons/web/static/src/css/base_old.css'
--- addons/web/static/src/css/base_old.css	2012-03-05 07:06:34 +0000
+++ addons/web/static/src/css/base_old.css	2012-03-16 04:23:20 +0000
@@ -1113,7 +1113,6 @@
 .openerp .oe_forms input.field_binary,
 .openerp .oe_forms input.field_email,
 .openerp .oe_forms input.field_url  {
-    border-right: none;
     -webkit-border-top-right-radius: 0px;
     -webkit-border-bottom-right-radius: 0px;
     -moz-border-radius-topright: 0px;

=== modified file 'addons/web/static/src/js/view_form.js'
--- addons/web/static/src/js/view_form.js	2012-03-13 16:37:19 +0000
+++ addons/web/static/src/js/view_form.js	2012-03-16 04:23:20 +0000
@@ -1487,7 +1487,7 @@
         if (!this.disable_utility_classes) {
             this.$element.toggleClass('disabled', this.readonly);
             this.$element.toggleClass('required', this.required);
-            if (show_invalid) {
+            if (show_invalid || !this.invalid) {
                 this.$element.toggleClass('invalid', !this.is_valid());
             }
         }
@@ -1976,72 +1976,6 @@
         var self = this;
         this.$input = this.$element.find("input");
         this.$drop_down = this.$element.find(".oe-m2o-drop-down-button");
-        this.$menu_btn = this.$element.find(".oe-m2o-cm-button");
-
-        // context menu
-        var init_context_menu_def = $.Deferred().then(function(e) {
-            var rdataset = new openerp.web.DataSetStatic(self, "ir.values", self.build_context());
-            rdataset.call("get", ['action', 'client_action_relate',
-                [[self.field.relation, false]], false, rdataset.get_context()], false, 0)
-                .then(function(result) {
-                self.related_entries = result;
-
-                var $cmenu = $("#" + self.cm_id);
-                $cmenu.append(QWeb.render("FieldMany2One.context_menu", {widget: self}));
-                var bindings = {};
-                bindings[self.cm_id + "_search"] = function() {
-                    if (self.readonly)
-                        return;
-                    self._search_create_popup("search");
-                };
-                bindings[self.cm_id + "_create"] = function() {
-                    if (self.readonly)
-                        return;
-                    self._search_create_popup("form");
-                };
-                bindings[self.cm_id + "_open"] = function() {
-                    if (!self.value) {
-                        return;
-                    }
-                    var pop = new openerp.web.form.FormOpenPopup(self.view);
-                    pop.show_element(
-                        self.field.relation,
-                        self.value[0],
-                        self.build_context(),
-                        {
-                            title: _t("Open: ") + (self.string || self.name)
-                        }
-                    );
-                    pop.on_write_completed.add_last(function() {
-                        self.set_value(self.value[0]);
-                    });
-                };
-                _.each(_.range(self.related_entries.length), function(i) {
-                    bindings[self.cm_id + "_related_" + i] = function() {
-                        self.open_related(self.related_entries[i]);
-                    };
-                });
-                var cmenu = self.$menu_btn.contextMenu(self.cm_id, {'noRightClick': true,
-                    bindings: bindings, itemStyle: {"color": ""},
-                    onContextMenu: function() {
-                        if(self.value) {
-                            $("#" + self.cm_id + " .oe_m2o_menu_item_mandatory").removeClass("oe-m2o-disabled-cm");
-                        } else {
-                            $("#" + self.cm_id + " .oe_m2o_menu_item_mandatory").addClass("oe-m2o-disabled-cm");
-                        }
-                        if (!self.readonly) {
-                            $("#" + self.cm_id + " .oe_m2o_menu_item_noreadonly").removeClass("oe-m2o-disabled-cm");
-                        } else {
-                            $("#" + self.cm_id + " .oe_m2o_menu_item_noreadonly").addClass("oe-m2o-disabled-cm");
-                        }
-                        return true;
-                    }, menuStyle: {width: "200px"}
-                });
-                $.async_when().then(function() {self.$menu_btn.trigger(e);});
-            });
-        });
-        var ctx_callback = function(e) {init_context_menu_def.resolve(e); e.preventDefault()};
-        this.$menu_btn.click(ctx_callback);
 
         // some behavior for input
         this.$input.keyup(function() {
@@ -2076,7 +2010,18 @@
                 }
             }
         };
-        this.$input.focusout(anyoneLoosesFocus);
+        var tooltip = function(){
+              if (!self.value && (self.$input.val()|| self.$element.hasClass('invalid'))) {
+                    if (self.required == true && self.$input.val().length >= 0) {
+                        self.$input.tipsy({title: function(){
+                            return self.string +' '+ self.$input.val()+ ' ' + 'does not exist.' + ' '+ 'You should create or select one from the dropdown list.'},
+                                      trigger:'manual',
+                                      fade: true,gravity:'s'}).tipsy("show");
+                        self.$element.addClass('invalid');
+                        $('.tipsy').delay(8000).fadeOut();}
+                   }else if( ! self.$element.hasClass('invalid')){self.$input.tipsy("hide")}
+        };
+        this.$input.focusout(anyoneLoosesFocus, tooltip);
 
         var isSelecting = false;
         // autocomplete
@@ -2097,7 +2042,7 @@
                 e.preventDefault();
             },
             html: true,
-            close: anyoneLoosesFocus,
+            close: (anyoneLoosesFocus,tooltip),
             minLength: 0,
             delay: 0
         });
@@ -2208,6 +2153,7 @@
     _change_int_ext_value: function(value) {
         this._change_int_value(value);
         this.$input.val(this.value ? this.value[1] : "");
+        if(this.value){this.$input.tipsy('hide')}
     },
     _change_int_value: function(value) {
         this.value = value;

=== modified file 'addons/web/static/src/xml/base.xml'
--- addons/web/static/src/xml/base.xml	2012-03-05 07:06:34 +0000
+++ addons/web/static/src/xml/base.xml	2012-03-16 04:23:20 +0000
@@ -1055,30 +1055,9 @@
             <span class="oe-m2o-drop-down-button">
                 <img t-att-src='_s + "/web/static/src/img/down-arrow.png"' /></span>
         </td>
-        <td>
-            <button class="oe_button oe_field_button oe-m2o-cm-button" t-att-id="widget.name + '_open'">
-                <img t-att-src='_s + "/web/static/src/img/icons/STOCK_DIRECTORY_MENU.png"'/>
-            </button>
-            <div t-att-id="widget.cm_id" class="contextMenu" style="display:none">
-            </div>
-        </td>
     </tr>
     </table>
 </t>
-<t t-name="FieldMany2One.context_menu">
-    <ul>
-        <li t-att-id="widget.cm_id + '_open'" style="color:grey" class="oe_m2o_menu_item_mandatory">Open...</li>
-        <li t-att-id="widget.cm_id + '_create'" class="oe_m2o_menu_item_noreadonly">Create...</li>
-        <li t-att-id="widget.cm_id + '_search'" class="oe_m2o_menu_item_noreadonly">Search...</li>
-        <t t-set="i" t-value="0"/>
-        <t t-foreach="widget.related_entries" t-as="entry">
-            <li t-att-id="widget.cm_id + '_related_' + i" style="color:grey" class="oe_m2o_menu_item_mandatory">
-                ... <t t-esc="(entry[2] || {})['name'] || ''"/>
-            </li>
-            <t t-set="i" t-value="i+1"/>
-        </t>
-    </ul>
-</t>
 <t t-name="FieldOne2Many">
 </t>
 <t t-name="FieldMany2Many">

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to