I want to know which variables i have available in my email templates.
How can I display all keys and values of the object-array to see what's available?
Something like this?
<t t-foreach=“object[]”>
<t t-out="object[key]”/>: <t t-out="object[value]”/><br/>
</t>
Hello
Try this
<t t-foreach="object._fields" t-as="field_name">
<t t-if="object[field_name]">
<t t-esc="field_name"/>:
<t t-esc="object[field_name]"/><br/>
</t>
</t>
@Codesphere Tech When I add this I get this error:
Error: You do not have enough rights to access the field "milestone_count" on Project (project.project). Please contact your system administrator.
Please verify that you are logged in as Administrator.
@Codesphere Yes I am. I'm even in Developer Mode. It works in most of them but not when 'Applies to: Project' and that's exactly where I need it.
I will check for Email Template: Applies To: Project and let you know here.
Some fields are restricted to specific user groups (for example, fields like milestone_count or duration_tracking in Projects). Even if you are logged in as Administrator or using Developer Mode, it does not guarantee access to those fields, because field-level security depends on group membership.
-> So I suggest that use specific known fields in the template or you can add admin to project group(not recommended).
@Codesphere
[-> So I suggest that use specific known fields in the template...]
That's exactly what I need this for, to see which variables are available.
[... or you can add admin to project group(not recommended)]
I am the creator/owner of the db so how can I get more rights than the ones I already have? Or is there a way to exclude these restricted variables from the query?
Hello,
Being the database owner or Administrator doesn’t automatically give unrestricted access to every field in Odoo.
Some fields are protected by field-level security or internal logic, so they may still be restricted even for admin users.
If you need access, you can:
-> Add your user to the relevant functional group (in this case, Project-related groups), if appropriate
-> Check available fields via Settings → Technical → Database Structure → Fields and filter by the Project model
I’ll explore other solutions for this.