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

because of problem while posting my previous topic, now i am posting it here.

please check my code below, i want to conatenate 2 fields o.name & o.ref to generate barcode in qweb pdf, how i can do it, please help.

img t-att-src="'/report/barcode/Code128/'+o.name + o.ref" style="width:200px;height:50px" alt="Barcode"


note: for a single value o.name its working fine, i can scan & check value through mobile app, but when concatenate 2 fields o.name + o.ref , its generating barcode in PDF but it is not showing anything when scanning through mobile app. means the generated barcode is not valid.

please help how i can do it?

regards

Ảnh đại diện
Huỷ bỏ

Please use the following code snippet without the '+' symbol and unwanted ''

<img t-attf-src="/report/barcode/Code128/{{o.name}}{{o.ref}}" style="width:200px;height:50px" alt="Barcode"/>

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

Hi,

There are multiple ways to concatenate two fields in a QWEB template. One approach is to use the `t-attf` property instead of `t-att`. Here is an example:

o.name}}{{o.ref}}" style="width:200px;height:50px" alt="Barcode">


By using `t-attf`, we can concatenate the values of the `o.name` and `o.ref` fields to construct the source URL for the barcode image. This makes the code more readable and allows for dynamic concatenation of field values

Hope it helps

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

please check the code, its not working... what i am doing wrong?
<img t-attf-src="'/report/barcode/Code128/'+{{o.name}}{{o.ref}}" style="width:200px;height:50px" alt="Barcode"/>
regards

Tác giả

thank you @Cybrosys, your code below is working but don't know what is the problem, on first page (first record) it is showing correct value John Ref001 when scanning through Mobile app and on 2nd page it is showing wrong value like: 1476925341 may be some kind of Code we are using to generate barcode.
please guide
regards

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 4 24
2378
0
thg 11 23
2020
1
thg 8 23
5199
1
thg 6 23
1932
0
thg 4 23
103