Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
1750 Vues

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.

Avatar
Ignorer
Auteur Meilleure réponse

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

Avatar
Ignorer
Meilleure réponse

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

Avatar
Ignorer
Publications associées Réponses Vues Activité
2
août 25
2328
0
mai 25
1029
0
août 24
1298
0
juil. 24
1769
2
mars 24
1622