[imp] modified m2o to use the mixin
bzr revid: nicolas.vanhoren@openerp.com-20120320102650-virv6zsj0gf0rjpw
This commit is contained in:
parent
386d00f00f
commit
cf4159c7f8
|
@ -1977,8 +1977,8 @@ openerp.web.form.dialog = function(content, options) {
|
|||
return dialog.$element;
|
||||
};
|
||||
|
||||
openerp.web.form.FieldMany2One = openerp.web.form.AbstractField.extend({
|
||||
template: 'EmptyComponent',
|
||||
openerp.web.form.FieldMany2One = openerp.web.form.AbstractField.extend(_.extend({}, openerp.web.form.ReinitializeFieldMixin, {
|
||||
template: "FieldMany2One",
|
||||
init: function(view, node) {
|
||||
this._super(view, node);
|
||||
this.limit = 7;
|
||||
|
@ -1987,23 +1987,12 @@ openerp.web.form.FieldMany2One = openerp.web.form.AbstractField.extend({
|
|||
this.last_search = [];
|
||||
this.tmp_value = undefined;
|
||||
},
|
||||
start: function() {
|
||||
this._super();
|
||||
this.render_content();
|
||||
this.on("change:effective_readonly", this, function() {
|
||||
this.render_content();
|
||||
});
|
||||
},
|
||||
render_content: function() {
|
||||
this.$element.html("");
|
||||
initialize_content: function() {
|
||||
if (!this.get("effective_readonly"))
|
||||
this.render_editable();
|
||||
else
|
||||
this.render_readonly();
|
||||
this.render_value();
|
||||
},
|
||||
render_editable: function() {
|
||||
this.$element.html(QWeb.render("FieldMany2One", {widget: this}));
|
||||
var self = this;
|
||||
this.$input = this.$element.find("input");
|
||||
this.$drop_down = this.$element.find(".oe-m2o-drop-down-button");
|
||||
|
@ -2142,9 +2131,6 @@ openerp.web.form.FieldMany2One = openerp.web.form.AbstractField.extend({
|
|||
isSelecting = false;
|
||||
});
|
||||
},
|
||||
render_readonly: function() {
|
||||
this.$element.html(QWeb.render("FieldMany2One_readonly"));
|
||||
},
|
||||
// autocomplete component content handling
|
||||
get_search_result: function(request, response) {
|
||||
var search_val = request.term;
|
||||
|
@ -2339,7 +2325,7 @@ openerp.web.form.FieldMany2One = openerp.web.form.AbstractField.extend({
|
|||
focus: function ($element) {
|
||||
this._super($element || this.$input);
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
/*
|
||||
# Values: (0, 0, { fields }) create
|
||||
|
|
|
@ -1037,6 +1037,7 @@
|
|||
</t>
|
||||
</t>
|
||||
<t t-name="FieldMany2One">
|
||||
<t t-if="!widget.get('effective_readonly')">
|
||||
<table t-attf-class="oe_form_field_#{widget.type}" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
|
@ -1053,9 +1054,12 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</t>
|
||||
<t t-name="FieldMany2One_readonly">
|
||||
</t>
|
||||
<t t-if="widget.get('effective_readonly')">
|
||||
<div>
|
||||
<a href="#" class="oe_form_uri"/>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
<t t-name="FieldMany2One.context_menu">
|
||||
<ul>
|
||||
|
|
Loading…
Reference in New Issue