Git Product home page Git Product logo

Comments (4)

sdegueldre avatar sdegueldre commented on July 26, 2024 1

You forgot to start the services, the localization service loads the translations. You can take a look at createPublicRoot in self_order_index.js of the pos_self_order module as an example, as the new pos self ordering app is an owl app served from a controller. But indeed this is not the appropriate repo for this question.

from owl.

ged-odoo avatar ged-odoo commented on July 26, 2024 1

we should have a howto on the official owl documentation for a setup for a controller in odoo with a minimal set of files, owl, templates properly setup, and translations as well

from owl.

ged-odoo avatar ged-odoo commented on July 26, 2024

task created id=3580007

from owl.

chrisb-c01 avatar chrisb-c01 commented on July 26, 2024

we should have a howto on the official owl documentation for a setup for a controller in odoo with a minimal set of files, owl, templates properly setup, and translations as well

That would be super helpful!

You forgot to start the services, the localization service loads the translations. You can take a look at createPublicRoot in self_order_index.js of the pos_self_order module as an example, as the new pos self ordering app is an owl app served from a controller. But indeed this is not the appropriate repo for this question.

Thanks for the quick reply @sdegueldre, sometimes it is difficult to pinpoint if its an issue on the owl side or Odoo side. I've added the startServices() as per your recommendation:

if (document.querySelector('#some-div')) {
    await whenReady();
    const env = makeEnv();
    await startServices(env);
    mount(
        ExampleComponent,
        document.querySelector("#some-div"),
        {
            env, templates, translateFn: _t, dev: true }
    );
}

However, I am now faced with all sorts of errors in the console (it even gets in a loop of errors):

Error: Cannot add 'EffectContainer' in the registry: it already exists
Error: Cannot add 'DialogContainer' in the registry: it already exists
Error: Cannot add '...' in the registry: it already exists
TypeError: Cannot redefine property: userContext
OwlError: Cannot make the given value reactive
TypeError: env.services.dialog.add is not a function
Error: UI service not initialized!

I tried to mount an App instance instead of the component itself as per the example you suggested (POS self order), however that did not solve it:

import { Component, whenReady, App } from "@odoo/owl";
const app = new App(ExampleComponent, {
        templates,
        env,
        dev: env.debug,
        translateFn: _t,
        translatableAttributes: [],
    });
app.mount(document.querySelector("#some-id");

Perhaps you have any suggestion?

cc @ged-odoo

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.