Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in TodoItem.xml on Odoo 14.0-20210204 (Community Edition) #2

Open
planctron opened this issue Oct 21, 2021 · 3 comments
Open

Bug in TodoItem.xml on Odoo 14.0-20210204 (Community Edition) #2

planctron opened this issue Oct 21, 2021 · 3 comments
Assignees

Comments

@planctron
Copy link

planctron commented Oct 21, 2021

Cannot overcome this Error when calling the view
Traceback:
Error: Invalid generated code while compiling template 'owl_tutorial_views.TreeItem': Unexpected identifier
at QWeb._compile (http://0.0.0.0:8097/web/content/510-34b6e20/web.assets_common.js:971:133)
at QWeb.fn (http://0.0.0.0:8097/web/content/510-34b6e20/web.assets_common.js:952:105)
at QWeb.render (http://0.0.0.0:8097/web/content/510-34b6e20/web.assets_common.js:959:20)
at PatchableClass.__render (http://0.0.0.0:8097/web/content/510-34b6e20/web.assets_common.js:1279:33)
at PatchableClass.__prepareAndRender (http://0.0.0.0:8097/web/content/510-34b6e20/web.assets_common.js:1277:29)

Error: Invalid generated code while compiling template 'owl_tutorial_views.TreeItem': Unexpected identifier
QWeb Compile

Some Experiment showed:
Error occurs in line 22
t-if="props.countField !== '' and props.item.hasOwnProperty(props.countField)"

@PhilDL
Copy link
Member

PhilDL commented Oct 21, 2021

Hi can you specify me:

  • Browser used
  • Are you on the latest code from the main branch ?
  • Can you go in the browser console and type owl.__info__ please ?

An up-to date Odoo 14 should show:

{version: '1.4.7', date: '2021-10-19T14:49:16.603Z', hash: '4e3b7c7', url: 'https://github.com/odoo/owl'}

Just before updating my Odoo i checked again an i can confirm that it works on Chrome with
OWL library > 1.4.4

@PhilDL PhilDL self-assigned this Oct 21, 2021
@planctron
Copy link
Author

I use the main branch and rely on the included OWL 1.2.3 (!!) of he Feb. Release.
Did not realize that this changed so much.
Is this the cause? My remark about the python code was nonsense. We are in JS here. I deleted it. Ok?

@PhilDL
Copy link
Member

PhilDL commented Oct 25, 2021

Hi @planctron, I was able to reproduce the error with exact version OWL 1.2.3.

Capture d’écran 2021-10-25 à 08 16 33

This is a very old version and there were some problems in the component life cycle and what you could do with props inside XML template expression.

I would strongly advise you to update your Odoo, I tested just the version after 1.2.4 and it is fixing the issue.

Thanks to you I will update the tutorial so people know that they need at least OWL > 1.2.4.

For your information, if you really want to make it work with your current version you can write the condition like that

<span 
    t-if="props.countField !== '' and props.item[props.countField] !== undefined" 
    class="badge badge-primary badge-pill" 
    t-esc="props.item[props.countField]">
</span>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants