Skip to Content
Menu
This question has been flagged
2 Replies
1155 Views

Hello everyone,

I'm currently working on customizing a module in Odoo 17 and have encountered an issue that I'm hoping to get some assistance with. I'm trying to extend App.kioskAttendanceApp.prototype by adding this.actionService = useService("action"); in the setup function. However, after making this change, I'm consistently getting an error message in the web console:

Error:
Error: Service action is not available

This error occurs even when I directly modify the original JavaScript file (without patch). Here's the code snippet where I've added the actionService:

javascript
/** @odoo-module **/
import { patch } from "@web/core/utils/patch";
import App from "@hr_attendance/public_kiosk/public_kiosk_app";
import { useService } from "@web/core/utils/hooks";
import { useBus } from "@web/core/utils/hooks";


patch(App.kioskAttendanceApp.prototype, {

    setup() {
        super.setup();
        console.log("setup kioskAttendanceApp");
        console.log(this.env);
        this.actionService = useService("action");
        },

    async triggerVehicleAction(action) {
        this.env.bus.trigger('perform_vehicle_action', {action});
    },

});



Does anyone have any insights into why this might be happening or suggestions on how to successfully include the action service in my extension? Any help or pointers would be greatly appreciated.

Thank you in advance!

Avatar
Discard
Author Best Answer

Still unsolved

Avatar
Discard
Best Answer

Hey, have you found the way how to override kioskAttendanceApp by change?
I though 

import kioskAttendanceApp from "@hr_attendance/public_kiosk/public_kiosk_app";
patch(kioskAttendanceApp.prototype, {

would help but not ... 

Avatar
Discard
Author

Hi Ana,

Unfortunately I was never able to solve this problem and therefore couldn't switch to v17 yet.

Last thing i tried was adding some assets.
But i never finished!

Pls. let me know if you find out.

'hr_attendance.assets_public_attendance': [
'web/static/tests/patch_translations.js',
'web/static/lib/jquery/jquery.js',
'web/static/src/legacy/js/**/*',
('remove', 'web/static/src/legacy/js/libs/**/*'),
('remove', 'web/static/src/legacy/js/public/**/*'),
'web/static/src/search/**/*',
'web/static/src/views/fields/field_tooltip.js',
'web/static/src/views/fields/field.js',
'web/static/src/views/onboarding_banner.js',
'web/static/src/views/utils.js',
'web/static/src/views/view_hook.js',
'web/static/src/views/view_service.js',
'web/static/src/views/view.js',
'web/static/src/model/relational_model/utils.js',
'web/static/src/webclient/actions/action_container.js',
'web/static/src/webclient/actions/action_dialog.js',
'web/static/src/webclient/actions/action_hook.js',
'web/static/src/webclient/actions/action_service.js',
'web/static/src/webclient/actions/reports/report_action.js',
'web/static/src/webclient/actions/reports/report_hook.js',
'web/static/src/webclient/actions/reports/utils.js',