Kunal Chavda (OpenERP) has proposed merging
lp:~openerp-dev/openerp-web/trunk-m2o-search_more-selection-kch 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-search_more-selection-kch/+merge/103613
Hello,
In Many2One field, while we click on search more option than popup opens with
result but when we close that popup without selection it will set first result
to that m2o field which is replace existing value of m2o. So I have fix this
problem.
Thanks,
Kunal Chavda(KCH)
--
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-m2o-search_more-selection-kch/+merge/103613
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openerp-web/trunk-m2o-search_more-selection-kch.
=== modified file 'addons/web/static/src/js/view_form.js'
--- addons/web/static/src/js/view_form.js 2012-04-25 14:23:36 +0000
+++ addons/web/static/src/js/view_form.js 2012-04-26 06:54:19 +0000
@@ -876,7 +876,7 @@
/**
* Default rendering engine for the form view.
- *
+ *
* It is necessary to set the view using set_view() before usage.
*/
instance.web.form.FormRenderingEngine = instance.web.Class.extend({
@@ -1462,7 +1462,7 @@
if (! v_context) {
v_context = (this.field || {}).context || {};
}
-
+
if (v_context.__ref || true) { //TODO: remove true
var fields_values = this._build_eval_context(blacklist);
v_context = new instance.web.CompoundContext(v_context).set_eval_context(fields_values);
@@ -1570,7 +1570,7 @@
/**
* Interface implemented by the form view or any other object
* able to provide the features necessary for the fields to work.
- *
+ *
* Properties:
* - display_invalid_fields : if true, all fields where is_valid() return true should
* be displayed as invalid.
@@ -1595,14 +1595,14 @@
/**
* Interface to be implemented by fields.
- *
+ *
* Properties:
* - readonly: boolean. If set to true the field should appear in readonly mode.
* - force_readonly: boolean, When it is true, the field should always appear
* in read only mode, no matter what the value of the "readonly" property can be.
* Events:
* - changed_value: triggered to inform the view to check on_changes
- *
+ *
*/
instance.web.form.FieldInterface = {
/**
@@ -1613,14 +1613,14 @@
init: function(field_manager, node) {},
/**
* Called by the form view to indicate the value of the field.
- *
+ *
* set_value() may return an object that can be passed to $.when() that represents the moment when
* the field has finished all operations necessary before the user can effectively use the widget.
- *
+ *
* Multiple calls to set_value() can occur at any time and must be handled correctly by the implementation,
* regardless of any asynchronous operation currently running and the status of any promise that a
* previous call to set_value() could have returned.
- *
+ *
* set_value() must be able, at any moment, to handle the syntax returned by the "read" method of the
* osv class in the OpenERP server as well as the syntax used by the set_value() (see below). It must
* also be able to handle any other format commonly used in the _defaults key on the models in the addons
@@ -1630,16 +1630,16 @@
set_value: function(value_) {},
/**
* Get the current value of the widget.
- *
+ *
* Must always return a syntaxically correct value to be passed to the "write" method of the osv class in
* the OpenERP server, although it is not assumed to respect the constraints applied to the field.
* For example if the field is marqued as "required", a call to get_value() can return false.
- *
+ *
* get_value() can also be called *before* a call to set_value() and, in that case, is supposed to
* return a defaut value according to the type of field.
- *
+ *
* This method is always assumed to perform synchronously, it can not return a promise.
- *
+ *
* If there was no user interaction to modify the value of the field, it is always assumed that
* get_value() return the same semantic value than the one passed in the last call to set_value(),
* altough the syntax can be different. This can be the case for type of fields that have a different
@@ -1669,14 +1669,14 @@
/**
* Abstract class for classes implementing FieldInterface.
- *
+ *
* Properties:
* - effective_readonly: when it is true, the widget is displayed as readonly. Vary depending
* the values of the "readonly" property and the "force_readonly" property on the field manager.
* - value: useful property to hold the value of the field. By default, set_value() and get_value()
* set and retrieve the value property. Changing the value property also triggers automatically
* a 'changed_value' event that inform the view to trigger on_changes.
- *
+ *
*/
instance.web.form.AbstractField = instance.web.form.Widget.extend(/** @lends instance.web.form.AbstractField# */{
/**
@@ -1693,7 +1693,7 @@
this.set({'value': false});
this.field = this.field_manager.get_field(this.name);
this.set({required: this.modifiers['required'] === true});
-
+
// some events to make the property "effective_readonly" sync automatically with "readonly" and
// "force_readonly"
this.set({"readonly": this.modifiers['readonly'] === true});
@@ -1703,7 +1703,7 @@
this.on("change:readonly", this, test_effective_readonly);
this.on("change:force_readonly", this, test_effective_readonly);
_.bind(test_effective_readonly, this)();
-
+
this.on("change:value", this, function() {
if (! this._inhibit_on_change)
this.trigger('changed_value');
@@ -1869,7 +1869,7 @@
}));
instance.web.form.FieldID = instance.web.form.FieldChar.extend({
-
+
});
instance.web.form.FieldEmail = instance.web.form.FieldChar.extend({
@@ -2246,7 +2246,7 @@
} else {
var self = this;
var option = _(this.values)
- .detect(function (record) { return record[0] === self.get('value'); });
+ .detect(function (record) { return record[0] === self.get('value'); });
this.$element.text(option ? option[1] : this.values[0][1]);
}
},
@@ -2332,7 +2332,7 @@
render_editable: function() {
var self = this;
this.$input = this.$element.find("input");
-
+
self.$input.tipsy({
title: function() {
return "No element was selected, you should create or select one from the dropdown list.";
@@ -2340,10 +2340,10 @@
trigger:'manual',
fade: true,
});
-
+
this.$drop_down = this.$element.find(".oe-m2o-drop-down-button");
this.$follow_button = $(".oe-m2o-cm-button", this.$element);
-
+
this.$follow_button.click(function() {
if (!self.get('value')) {
return;
@@ -2367,6 +2367,7 @@
this.$input.keyup(function() {
if (self.$input.val() === "") {
self.set({value: false});
+ self.floating = false;
} else {
self.floating = true;
}
@@ -2435,7 +2436,7 @@
self.display_value["" + item.id] = item.name;
self.set({value: item.id});
} else if (item.action) {
- self.floating = true;
+ self.floating = false;
item.action();
return false;
}
@@ -2669,7 +2670,7 @@
this.dataset.o2m = this;
this.dataset.parent_view = this.view;
this.dataset.child_name = this.name;
- //this.dataset.child_name =
+ //this.dataset.child_name =
this.dataset.on_change.add_last(function() {
self.trigger_on_change();
});
@@ -2696,7 +2697,7 @@
},
load_views: function() {
var self = this;
-
+
var modes = this.node.attrs.mode;
modes = !!modes ? modes.split(",") : ["tree"];
var views = [];
@@ -3031,7 +3032,7 @@
self.o2m.reload_current_view();
});
});
-
+
},
});
}
@@ -3058,7 +3059,7 @@
this.dataset.on_unlink.add_last(function(ids) {
self.dataset_changed();
});
-
+
this.is_setted.then(function() {
self.load_view();
});
_______________________________________________
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