Añade la funcionalidad de pos_empty_default_image pra poder mostraar el formato en productos sin imagen
This commit is contained in:
parent
f1c8cf8414
commit
913de79db8
14 changed files with 284 additions and 41 deletions
|
|
@ -2,10 +2,12 @@ odoo.define('product_library.product_library', function (require) {
|
|||
"use strict";
|
||||
|
||||
var models = require('point_of_sale.models');
|
||||
var screens = require('point_of_sale.screens');
|
||||
var core = require('web.core');
|
||||
var gui = require('point_of_sale.gui');
|
||||
var _t = core._t;
|
||||
//var screens = require('point_of_sale.screens');
|
||||
//var core = require('web.core');
|
||||
//var gui = require('point_of_sale.gui');
|
||||
//var _t = core._t;
|
||||
|
||||
models.load_fields("product.product", ['has_image']);
|
||||
|
||||
/* ********************************************************
|
||||
Overload models.PosModel
|
||||
|
|
@ -15,7 +17,7 @@ Overload models.PosModel
|
|||
models.PosModel = models.PosModel.extend({
|
||||
initialize: function (session, attributes) {
|
||||
|
||||
this.member_categories = [];
|
||||
//this.member_categories = [];
|
||||
|
||||
var product_model = _.find(this.models, function(model){ return model.model === 'product.product'; });
|
||||
//product_model.fields.push('default_code');
|
||||
42
product_library/static/src/js/widgets.js
Normal file
42
product_library/static/src/js/widgets.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
odoo.define('product_library.widgets', function (require) {
|
||||
"use strict";
|
||||
|
||||
var screens = require('point_of_sale.screens');
|
||||
|
||||
var core = require('web.core');
|
||||
|
||||
var QWeb = core.qweb;
|
||||
|
||||
//don't try to get an image if we know the product ain't one
|
||||
var ProductListImageWidget = screens.ProductListWidget.include({
|
||||
get_product_image_url: function(product){
|
||||
if (product.has_image)
|
||||
return this._super(product);
|
||||
},
|
||||
|
||||
// Change product display if product has no image;
|
||||
render_product: function(product){
|
||||
if (product.has_image){
|
||||
return this._super(product);
|
||||
}
|
||||
else {
|
||||
var current_pricelist = this._get_active_pricelist();
|
||||
var cache_key = this.calculate_cache_key(product, current_pricelist);
|
||||
var cached = this.product_cache.get_node(cache_key);
|
||||
if(!cached){
|
||||
var product_html = QWeb.render('ProductNoImage',{
|
||||
widget: this,
|
||||
product: product,
|
||||
pricelist: current_pricelist,
|
||||
});
|
||||
var product_node = document.createElement('div');
|
||||
product_node.innerHTML = product_html;
|
||||
product_node = product_node.childNodes[1];
|
||||
this.product_cache.cache_node(cache_key,product_node);
|
||||
return product_node;
|
||||
}
|
||||
return cached;
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue