Skip to Content
Menu
This question has been flagged
2545 Views

If I want a specific element to be shown in a specific model. I will write the following xml:

<div t-if="widget.model == 'account.invoice'">
</div>

If I want to do the same thin jquery what should I do?

Actually I am trying to show a different placeholder image for the propduct.product model. for other models I want to show the same as the odoo is showing.

Odoo is setting the placeholder with the following code:

var FieldBinaryImage = FieldBinary.extend({
  template: 'FieldBinaryImage',
  placeholder: "/web/static/src/img/placeholder.png",
  render_value: function() {
  var url = this.placeholder;
  if(this.get('value')) {
  if(!utils.is_bin_size(this.get('value'))) {
  url = 'data:image/png;base64,' + this.get('value');
  } else {
  url = session.url('/web/image', {
  model: this.view.dataset.model,
  id: JSON.stringify(this.view.datarecord.id || null),
  field: (this.options.preview_image)? this.options.preview_image : this.name,
  unique: (this.view.datarecord.__last_update || '').replace(/[^0-9]/g, ''),
  });
  }
  }

How can I apply a condition to change the placeholder image for the specific model?

Avatar
Discard
Related Posts Replies Views Activity
1
Aug 23
28078
2
May 17
2486
0
Apr 17
1786
1
Mar 15
7304
1
Jun 17
2170