[FIX] point_of_sale: coherent image url handling
bzr revid: fva@openerp.com-20120910154828-4k699hi3lu8lgxvu
This commit is contained in:
parent
9f6786c139
commit
83fc106eaa
|
@ -48,7 +48,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
||||||
'units': null,
|
'units': null,
|
||||||
'units_by_id': null,
|
'units_by_id': null,
|
||||||
|
|
||||||
'selectedOrder': undefined,
|
'selectedOrder': null,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.get('orders').bind('remove', function(){ self.on_removed_order(); });
|
this.get('orders').bind('remove', function(){ self.on_removed_order(); });
|
||||||
|
@ -310,6 +310,9 @@ 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(){
|
||||||
|
return '/web/binary/image?session_id='instance.session.session_id+'&model=product.product&field=image&id='+this.get('id');
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
module.ProductCollection = Backbone.Collection.extend({
|
module.ProductCollection = Backbone.Collection.extend({
|
||||||
|
@ -339,7 +342,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
||||||
get_discount: function(){
|
get_discount: function(){
|
||||||
return this.discount;
|
return this.discount;
|
||||||
},
|
},
|
||||||
// FIXME
|
|
||||||
get_product_type: function(){
|
get_product_type: function(){
|
||||||
return this.type;
|
return this.type;
|
||||||
},
|
},
|
||||||
|
|
|
@ -521,13 +521,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
|
||||||
var product = this.get_product();
|
var product = this.get_product();
|
||||||
return (product ? product.get('list_price') : 0) || 0;
|
return (product ? product.get('list_price') : 0) || 0;
|
||||||
},
|
},
|
||||||
get_product_image_url: function() {
|
|
||||||
var product = this.get_product();
|
|
||||||
if(!product){
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return '/web/binary/image?session_id='+instance.session.session_id+'&model=product.product&field=image&id='+product.get('id');
|
|
||||||
},
|
|
||||||
get_product_weight: function(){
|
get_product_weight: function(){
|
||||||
return this.weight || 0;
|
return this.weight || 0;
|
||||||
},
|
},
|
||||||
|
|
|
@ -284,12 +284,9 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
|
||||||
this.click_product_action = options.click_product_action;
|
this.click_product_action = options.click_product_action;
|
||||||
},
|
},
|
||||||
// returns the url of the product thumbnail
|
// returns the url of the product thumbnail
|
||||||
get_image_url: function() {
|
|
||||||
return '/web/binary/image?session_id='+instance.session.session_id+'&model=product.product&field=image&id='+this.model.get('id');
|
|
||||||
},
|
|
||||||
renderElement: function() {
|
renderElement: function() {
|
||||||
this._super();
|
this._super();
|
||||||
this.$('img').replaceWith(this.pos_widget.image_cache.get_image(this.get_image_url()));
|
this.$('img').replaceWith(this.pos_widget.image_cache.get_image(this.model.get_image_url()));
|
||||||
var self = this;
|
var self = this;
|
||||||
$("a", this.$el).click(function(e){
|
$("a", this.$el).click(function(e){
|
||||||
if(self.click_product_action){
|
if(self.click_product_action){
|
||||||
|
|
|
@ -185,8 +185,8 @@
|
||||||
<span class="product-price">
|
<span class="product-price">
|
||||||
<t t-esc="widget.format_currency(widget.get_product_price()) + '/Kg'" />
|
<t t-esc="widget.format_currency(widget.get_product_price()) + '/Kg'" />
|
||||||
</span>
|
</span>
|
||||||
<t t-if="widget.get_product_image_url()">
|
<t t-if="widget.get_product()">
|
||||||
<img t-att-src="widget.get_product_image_url()" />
|
<img t-att-src="widget.get_product().get_image_url()" />
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -346,7 +346,8 @@
|
||||||
<t t-name="ErrorPopupWidget">
|
<t t-name="ErrorPopupWidget">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="popup popup-help">
|
<div class="popup popup-help">
|
||||||
<p class="message"><t t-esc=" widget.message || 'Product not Found' " /></p>
|
<p class="message"><t t-esc=" widget.message || 'Error' " /></p>
|
||||||
|
<p class="comment"><t t-esc=" widget.comment || '' "/></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
|
|
Loading…
Reference in New Issue