You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
943 B

  1. odoo.define('pos_default_empty_image', function (require) {
  2. "use strict";
  3. var models = require('point_of_sale.models');
  4. var screens = require('point_of_sale.screens');
  5. //don't try to get an image if we know the product ain't one
  6. var ProductListImageWidget = screens.ProductListWidget.include({
  7. get_product_image_url: function(product){
  8. if (product.has_image)
  9. return this._super(product);
  10. return '/web/static/src/img/placeholder.png';
  11. }
  12. });
  13. var _super_posmodel = models.PosModel.prototype;
  14. models.PosModel = models.PosModel.extend({
  15. initialize: function (session, attributes) {
  16. var product_model = _.find(this.models, function(model){ return model.model === 'product.product'; });
  17. product_model.fields.push('has_image');
  18. return _super_posmodel.initialize.call(this, session, attributes);
  19. },
  20. });
  21. });