[ADD] Added url field

bzr revid: fme@openerp.com-20110519135522-d79lb4j7j06aizpd
This commit is contained in:
Fabien Meghazi 2011-05-19 15:55:22 +02:00
parent fa36a75353
commit ff6e1e6b86
2 changed files with 29 additions and 0 deletions

View File

@ -679,6 +679,21 @@ openerp.base.form.FieldEmail = openerp.base.form.FieldChar.extend({
});
openerp.base.form.FieldUrl = openerp.base.form.FieldChar.extend({
init: function(view, node) {
this._super(view, node);
this.template = "FieldUrl";
},
start: function() {
this._super.apply(this, arguments);
this.$element.find('button').click(this.on_button_clicked);
},
on_button_clicked: function() {
if (!this.value) {
this.notification.warn("Resource error", "This resource is empty");
} else {
window.open(this.value);
}
}
});
openerp.base.form.FieldFloat = openerp.base.form.FieldChar.extend({

View File

@ -328,6 +328,20 @@
</tr>
</table>
</t>
<t t-name="FieldUrl">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td width="100%">
<t t-call="FieldChar"/>
</td>
<td width="16">
<button type="button" class="button" title="Open this resource">
<img src="/base/static/src/img/icons/gtk-ok.png"/>
</button>
</td>
</tr>
</table>
</t>
<t t-name="FieldText">
<textarea rows="6" style="width: 100%;"
t-att-name="widget.name"