Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
7322 Lượt xem

I just recited qweb:

- I created an additional fileds to upload photos to the stock.location table

-location has paternity

-up up photos for father location

-in report mrp_repair I want to rely on "Current Location

"to retrieve the image to display on the report.

I just approached qweb:

I am having an error showing the image to show, very grateful for the help

class MrpRepair(models.Model):
_inherit = 'mrp.repair'

img_location_compute = fields.Binary(compute="_compute_img_location")

@api.multi
def _compute_img_location(self):
has_img = self
while not has_img.img_location and has_img.location_id:
has_img = has_img.partner_id
self.img_location_compute = has_img.img_location

class StockLocation(models.Model):
_inherit = "stock.location"

img_location = fields.Binary('Địa chỉ location')

<img t-if="location_id.location_id.img_location" t-att-src="'data:image/png;base64,%s' % location_id.location_id.img_location"/>
Ảnh đại diện
Huỷ bỏ
Tác giả

thanks. but it doesn't work with me. .I don't know what's going on,

Câu trả lời hay nhất

Hope this will helps:

<img t-attf-src="data:image/jpg;base64,{{ model.some_logo }}" align="left" height="65" width="65" style='margin:0px;padding-top:0px;' />


Ảnh đại diện
Huỷ bỏ
Tác giả

thank,. but it doesn't work with me. .I don't know what's going on,

Câu trả lời hay nhất

Hello vu van tien,

For Odoo-10.0 :-
<img t-if="location_id.location_id.img_wh" t-att-src="'data:image/png;base64,%s' % location_id.location_id.img_wh"/>

For Odoo-12.0 :-
<img t-if="location_id.location_id.img_wh" t-att-src="'data:image/png;base64,%s' % to_text(location_id.location_id.img_wh)"/>

Hope it will works for you.
Thanks,

Ảnh đại diện
Huỷ bỏ
Tác giả

I'm still in trouble. the above does not solve this problem,

Câu trả lời hay nhất

Hello,

Try Below Code may be it's help you:

<img t-if="location_id.location_id.img_wh" t-att-src="'data:image/png;base64,%s' % location_id.location_id.img_wh"/>


Thanks.

Ảnh đại diện
Huỷ bỏ
Tác giả

thank, This code I used before but it did not work

Bài viết liên quan Trả lời Lượt xem Hoạt động
5
thg 12 19
11111
1
thg 9 18
8141
1
thg 9 18
7826
1
thg 2 18
9693
3
thg 7 25
27040