Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

241
Views
Odoo 15 | act_window with useService Hook don't work in custom OWL component in setup method

I'm trying to register an act_window withing the setup method using the useService Hook, but it doesn't work.

This is my component.

    /** @odoo-module **/
    // const { useState, useRef } = owl.hooks;
    import { useEffect, useService } from "@web/core/utils/hooks";
    import AbstractField from 'web.AbstractFieldOwl'
    import { _lt } from 'web.translation';
    
    class ReferenceButtonWidget extends AbstractField {
    
      setup() {
        // super.setup(...arguments);
        this.actionService = useService('action')  // <----------------- ERROR
      }
    
      onClick() {
        console.log(this.value);
      }
    }
    
    ReferenceButtonWidget.description = _lt("Reference");
    ReferenceButtonWidget.supportedFieldTypes = ['reference'];
    ReferenceButtonWidget.template = 'iqba_document.reference_button_widget';
    
    
    const registry = require('web.field_registry_owl');
    
    registry.add('reference_button_widget', ReferenceButtonWidget)

If I comment the this.actionService = useService('action') line, my component renders ok.

If I pause the execution at that point, only these services are available:

browser debug console

What am I doing wrong? Thanks

For now I'm using this to call an action:

    this.__owl__.parent.parentWidget.do_action({
            type: 'ir.actions.act_window',
            res_model: this.value.model,
            res_id: this.value.res_id,
            views: [[false, 'form']],
            target: 'new'
          })

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!