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

Hello to everybody,

I'm using version 15 online. In CRM application, I'm working with Studio in order to arrange for an email template where the text of the message is built in function of specific tags set in the lead/opportunity. 

I tried object.tags ...but the following error rises:

--------------------------

Failed to render QWeb template : 'crm.lead' object has no attribute 'tags' Traceback (most recent call last): File "/home/odoo/src/odoo/15.0/odoo/addons/base/models/qweb.py", line 219, in render_template yield from compiled_fn(self, values, log) File "", line 6, in template AttributeError: 'crm.lead' object has no attribute 'tags' Error when render the template AttributeError: 'crm.lead' object has no attribute 'tags' Template: Path: /div/t[2] Node: )

--------------------------

Is there any way to do this? Or a workaround?

Thanks! 

Regards, 

Max.

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Dear Niyas Raphy, many thanks for the fast and proper reply. I now realized to have wrongly operated.

Going further, I applied your correction and that error doesn't rise anymore. Good Job.

In any case, I'm not able to fulfill my job and I'm sure to wrongly refer to the fields and values.

If it is possible I would post, looking for additional support, please.

This is my code and I'm bolding the responsible command:

t-if="1960 in object.tag_ids" data-oe-t-group="0" data-oe-t-selectable="true" data-oe-t-group-active="true" data-oe-t-inline="true">

With this I receive the following error

----------------------------

User Error

×

Failed to render QWeb template : unsupported operand type(s) for "in": 'crm.tag()' and '' Traceback (most recent call last): File "/home/odoo/src/odoo/15.0/odoo/addons/base/models/qweb.py", line 219, in render_template yield from compiled_fn(self, values, log) File "", line 6, in template File "/home/odoo/src/odoo/15.0/odoo/models.py", line 5775, in __contains__ raise TypeError(f"unsupported operand type(s) for \"in\": '{self._name}()' and '{type(item)}'") TypeError: unsupported operand type(s) for "in": 'crm.tag()' and '' Error when render the template TypeError: unsupported operand type(s) for "in": 'crm.tag()' and '' Template: Path: /div/t[2] Node: )

----------------------------

Can you please suggest how should I write the command correctly? Thank you for your time, anyway.

Best regards

Max

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,
You have to use technical name of the field, here it is: tag_ids

You can activate the developer mode and hover the mouse on the field, then you will get the technical name of field in the pop up.

Thanks

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 8 25
2546
0
thg 5 25
1129
0
thg 8 24
1397
0
thg 7 24
1900
2
thg 3 24
1709