Closed amir-rismani closed 11 months ago
Hello, the issue is that you're not starting the services so useService cannot possibly work. Try following this guide which I recently wrote: https://www.odoo.com/documentation/master/developer/howtos/standalone_owl_application.html
I'm going to close this issue as it is not related to Owl itself but how to use Owl within Odoo. If it is a bug or feature request it should be an issue on the Odoo repo, if it's an issue with using using the code or the tutorial it should be an issue on the documentation repo
@sdegueldre You were right, I used mountComponent
instead of mount
to start the servers and the problem was solved.
thanks for your reply
Good luck
Hi @sdegueldre , thanks for your tips. I'm using your proposal with mountComponent yet as I follow you tuto on Odoo doc it looks like mountComponent should be part of @web/env AFAICS, there is no such method in @web/env , only in owl ... Ah my bad, available in 17.0 not in v16.
Maybe using startWebClient in @web/start could be a good choice ?
@sdegueldre You were right, I used
mountComponent
instead ofmount
to start the servers and the problem was solved.thanks for your reply
Good luck
Could you share your solution ?
hum, looks like it works for a owl applicaton. What is the process to hook a component into a portal website page for example. I've succeed in mouting the component but wahrerver the method, impossible to have services. UseService failed either with the v16 or v17 flavor with mountComponent. Is it necessary to use OwlCompatibility because website still designed in old framework ? Regards
If you want to be able to use useService
your app's environment needs to contain the started services. In 17.0+ you can use mountComponent
which does that for you automatically, but in lower versions you'll have to create your env yourself and start the services in that environment. You'll also need to make sure that the code for the services that you want to use and their dependencies are loaded in the correct assets bundle (assets_frontend for portal). I wouldn't recommend using startWebClient
directly, as it does a few things that are specific to the actual webclient, but your starting code should do most of what startWebClient
does.
In the website and portal, we already start the services and they can only be started once, so you'll have to reuse that env. I've replied to you on another issue about how to achieve this.
Hi gays i have question, i need to patch some code to Order class that located in pos/app/store/models when i inherit setup function and i need to use orm services it show error
hi @HamidAbdalla123 , this issue is closed. Moreover you didn't provides enough details so we can't identify if its an owl or Odoo issue. Please open a proper issue.
I am developing a small Todo List app on Odoo 17 to learn Owl. Everything was progressing smoothly until I attempted to dynamically fetch and display data using orm with useService. I encountered the following error:
I have extensively tried to resolve the issue by consulting the Owl and Odoo documentation, as well as searching for solutions online, but without success. The code adheres to the documentation, and I am uncertain about the source of this error.
Steps to Reproduce:
odoo 17
)odoo_owl_app
addon/owl-app
route to see the result.Code: The
root.js
file contains the following codes:When this code
this.orm = useService("orm");
is added to the setup, the following error is issued:Screenshot:
Additional Information:
Projects:
I appreciate any assistance in resolving this issue and gaining a better understanding of using Owl with Odoo.