[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;
|
return dialog.$element;
|
||||||
};
|
};
|
||||||
|
|
||||||
openerp.web.form.FieldMany2One = openerp.web.form.AbstractField.extend({
|
openerp.web.form.FieldMany2One = openerp.web.form.AbstractField.extend(_.extend({}, openerp.web.form.ReinitializeFieldMixin, {
|
||||||
template: 'EmptyComponent',
|
template: "FieldMany2One",
|
||||||
init: function(view, node) {
|
init: function(view, node) {
|
||||||
this._super(view, node);
|
this._super(view, node);
|
||||||
this.limit = 7;
|
this.limit = 7;
|
||||||
|
@ -1987,23 +1987,12 @@ openerp.web.form.FieldMany2One = openerp.web.form.AbstractField.extend({
|
||||||
this.last_search = [];
|
this.last_search = [];
|
||||||
this.tmp_value = undefined;
|
this.tmp_value = undefined;
|
||||||
},
|
},
|
||||||
start: function() {
|
initialize_content: function() {
|
||||||
this._super();
|
|
||||||
this.render_content();
|
|
||||||
this.on("change:effective_readonly", this, function() {
|
|
||||||
this.render_content();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
render_content: function() {
|
|
||||||
this.$element.html("");
|
|
||||||
if (!this.get("effective_readonly"))
|
if (!this.get("effective_readonly"))
|
||||||
this.render_editable();
|
this.render_editable();
|
||||||
else
|
|
||||||
this.render_readonly();
|
|
||||||
this.render_value();
|
this.render_value();
|
||||||
},
|
},
|
||||||
render_editable: function() {
|
render_editable: function() {
|
||||||
this.$element.html(QWeb.render("FieldMany2One", {widget: this}));
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this.$input = this.$element.find("input");
|
this.$input = this.$element.find("input");
|
||||||
this.$drop_down = this.$element.find(".oe-m2o-drop-down-button");
|
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;
|
isSelecting = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
render_readonly: function() {
|
|
||||||
this.$element.html(QWeb.render("FieldMany2One_readonly"));
|
|
||||||
},
|
|
||||||
// autocomplete component content handling
|
// autocomplete component content handling
|
||||||
get_search_result: function(request, response) {
|
get_search_result: function(request, response) {
|
||||||
var search_val = request.term;
|
var search_val = request.term;
|
||||||
|
@ -2339,7 +2325,7 @@ openerp.web.form.FieldMany2One = openerp.web.form.AbstractField.extend({
|
||||||
focus: function ($element) {
|
focus: function ($element) {
|
||||||
this._super($element || this.$input);
|
this._super($element || this.$input);
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
# Values: (0, 0, { fields }) create
|
# Values: (0, 0, { fields }) create
|
||||||
|
|
|
@ -1037,25 +1037,29 @@
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
<t t-name="FieldMany2One">
|
<t t-name="FieldMany2One">
|
||||||
<table t-attf-class="oe_form_field_#{widget.type}" cellpadding="0" cellspacing="0" border="0">
|
<t t-if="!widget.get('effective_readonly')">
|
||||||
<tr>
|
<table t-attf-class="oe_form_field_#{widget.type}" cellpadding="0" cellspacing="0" border="0">
|
||||||
<td valign="top">
|
<tr>
|
||||||
<t t-call="FieldChar"/>
|
<td valign="top">
|
||||||
<span class="oe-m2o-drop-down-button">
|
<t t-call="FieldChar"/>
|
||||||
<img t-att-src='_s + "/web/static/src/img/down-arrow.png"' /></span>
|
<span class="oe-m2o-drop-down-button">
|
||||||
</td>
|
<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'">
|
<td>
|
||||||
<img t-att-src='_s + "/web/static/src/img/icons/STOCK_DIRECTORY_MENU.png"'/>
|
<button class="oe_button oe_field_button oe-m2o-cm-button" t-att-id="widget.name + '_open'">
|
||||||
</button>
|
<img t-att-src='_s + "/web/static/src/img/icons/STOCK_DIRECTORY_MENU.png"'/>
|
||||||
<div t-att-id="widget.cm_id" class="contextMenu" style="display:none">
|
</button>
|
||||||
</div>
|
<div t-att-id="widget.cm_id" class="contextMenu" style="display:none">
|
||||||
</td>
|
</div>
|
||||||
</tr>
|
</td>
|
||||||
</table>
|
</tr>
|
||||||
</t>
|
</table>
|
||||||
<t t-name="FieldMany2One_readonly">
|
</t>
|
||||||
<a href="#" class="oe_form_uri"/>
|
<t t-if="widget.get('effective_readonly')">
|
||||||
|
<div>
|
||||||
|
<a href="#" class="oe_form_uri"/>
|
||||||
|
</div>
|
||||||
|
</t>
|
||||||
</t>
|
</t>
|
||||||
<t t-name="FieldMany2One.context_menu">
|
<t t-name="FieldMany2One.context_menu">
|
||||||
<ul>
|
<ul>
|
||||||
|
|
Loading…
Reference in New Issue