In openerp nearly %90 of the links doesnot work when I try to open them in new window.
How can we open links in new browser window ?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
In openerp nearly %90 of the links doesnot work when I try to open them in new window.
How can we open links in new browser window ?
Because all of them are using JavaScript. You have to use widget on your field or your button. and then using JavaScript in the widget to open the link. this is JavaScript that open link in new tab or you can research the JavaScript code to open in new windows. or you can see example in addon/web/static/js/view_form.js or view_list.js
window.open([url],"_blank");
I create a new widget that opens links in different tabs: /addon_name/static/src/tabs.js:
openerp.lqp_sale_order = function (instance){
instance.web.form.widgets.add('links', 'instance.lqp_sale_order.Mywidget');
instance.lqp_sale_order.Mywidget = instance.web.form.FieldChar.extend({
template : 'links',
init: function(view, code){
this._super(view, code);
console.log("Inicio", this._super(view, code));
},
start: function() {
$('button#bopentab').click(this.open_urls);
},
open_urls: function() {
var context;
var ids = [];
if ($.bbq.getState().id){
ids = [parseInt($.bbq.getState().id)];
}
console.log("ID activo: ", ids);
var ds = new instance.web.DataSet(this, 'sale.order', context);
ds.call('action_button_open_url', [ids]).done(function(r){
for( i in r){
window.open(r[i]);
console.log("Link Individual: ",r[i]);
}
});
},
});
};
/addon_name/static/src/tabs.xml:
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="links">
<button type="button" id="bopentab">Abrir Enlaces</button>
</t>
</templates>
and the view just type:
<field name="field" widget="links" />
unfortunate mind is the first widget I created and I have not much experience on this, it generates an error when editing a quote or to create it, saying:
TypeError: this.$(...)[0] is undefined
I think something is poorly defined, but I hope you serve as an example.
Create an account today to enjoy exclusive features and engage with our awesome community!
RegistracijaRelated Posts | Replies | Rodiniai | Veikla | |
---|---|---|---|---|
|
0
liep. 23
|
792 | ||
|
0
gruod. 22
|
1418 | ||
|
4
kov. 24
|
7543 | ||
|
1
bal. 15
|
8698 | ||
|
0
kov. 15
|
3184 |
Are you asking for multiple tab functionality? http://help.openerp.com/question/3938/how-to-use-tabs-in-the-web-client/