Git Product home page Git Product logo

Comments (8)

sdegueldre avatar sdegueldre commented on July 26, 2024

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

from owl.

amir-rismani avatar amir-rismani commented on July 26, 2024

@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

from owl.

flotho avatar flotho commented on July 26, 2024

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 ?

from owl.

flotho avatar flotho commented on July 26, 2024

@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

Could you share your solution ?

from owl.

flotho avatar flotho commented on July 26, 2024

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

from owl.

sdegueldre avatar sdegueldre commented on July 26, 2024

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.

from owl.

HamidAbdalla123 avatar HamidAbdalla123 commented on July 26, 2024

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

from owl.

flotho avatar flotho commented on July 26, 2024

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.

from owl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.