Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
2002 มุมมอง

I want to use web.rpc on my JS to manipulate display on pivot table, but it get error like unmet dependencies. I use like this 

var rpc = require('web.rpc');

but that get error on odoo 17, and I want to use that for rpc.query. Any alternative or solution with that approach ?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You can used to import the useService hook from the @web/core/utils/hooks package in Odoo's JavaScript framework.


// Example 


import { useService } from "@web/core/utils/hooks";


export const MyComponent = () => {

    setup() {

        super.setup();

        this.rpc = useService("rpc");

    }


    async onClickRPC() {

        await this.rpc("URL", {

            model: 'res.users',

            method: 'method_name',

            args: [],

            kwargs: {}

        })

    }

};





อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ส.ค. 24
979
Website Customization แก้ไขแล้ว
1
พ.ค. 24
1260
2
มี.ค. 15
17099
1
มี.ค. 15
4385
2
ก.ค. 25
1157