[FIX] use session.url()
bzr revid: chs@openerp.com-20121114174258-ly0dniub0k383045
This commit is contained in:
parent
eb5a5bf838
commit
fa8463f804
|
@ -56,12 +56,14 @@ openerp.mail = function (session) {
|
||||||
|
|
||||||
/* Get an image in /web/binary/image?... */
|
/* Get an image in /web/binary/image?... */
|
||||||
get_image: function (session, model, field, id, resize) {
|
get_image: function (session, model, field, id, resize) {
|
||||||
return session.prefix + '/web/binary/image?session_id=' + session.session_id + '&model=' + model + '&field=' + field + '&id=' + (id || '') + '&resize=' + (resize ? encodeURIComponent(resize) : '');
|
var r = resize ? encodeURIComponent(resize) : '';
|
||||||
|
id = id || '';
|
||||||
|
return session.url('/web/binary/image', {model: model, field: field, id: id, resize: r});
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Get the url of an attachment {'id': id} */
|
/* Get the url of an attachment {'id': id} */
|
||||||
get_attachment_url: function (session, attachment) {
|
get_attachment_url: function (session, attachment) {
|
||||||
return session.origin + '/web/binary/saveas?session_id=' + session.session_id + '&model=ir.attachment&field=datas&filename_field=datas_fname&id=' + attachment['id'];
|
return session.url('/web/binary/saveas', {model: 'ir.attachment', field: 'datas', filename_field: 'datas_fname', id: attachment['id']});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -320,7 +320,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
||||||
|
|
||||||
module.Product = Backbone.Model.extend({
|
module.Product = Backbone.Model.extend({
|
||||||
get_image_url: function(){
|
get_image_url: function(){
|
||||||
return '/web/binary/image?session_id='+instance.session.session_id+'&model=product.product&field=image&id='+this.get('id');
|
return instance.session.url('/web/binary/image', {model: 'product.product', field: 'image', id: this.get('id')});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -474,7 +474,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
|
||||||
},
|
},
|
||||||
|
|
||||||
get_image_url: function(category){
|
get_image_url: function(category){
|
||||||
return '/web/binary/image?session_id='+instance.session.session_id+'&model=pos.category&field=image&id='+category.id;
|
return instance.session.url('/web/binary/image', {model: 'pos.category', field: 'image', id: category.id});
|
||||||
},
|
},
|
||||||
|
|
||||||
renderElement: function(){
|
renderElement: function(){
|
||||||
|
|
Loading…
Reference in New Issue