콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3202 화면

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?

아바타
취소
관련 게시물 답글 화면 활동
1
8월 23
28923
2
5월 17
3298
0
4월 17
2409
1
3월 15
7975
1
6월 17
2957