Odoo 10 - "Overwriting" Javascript Code from the old module

I'm trying to make changes to some javascript in a new module, but I can’t understand for life what I'm doing wrong.

https://github.com/odoo/odoo/blob/10.0/addons/hr_attendance/static/src/js/kiosk_confirm.js

This is the code I'm trying to change, in particular this snippet:

this.next_action = 'hr_attendance.hr_attendance_action_kiosk_mode';

And this is the code that I have received so far, which, in my opinion, is the closest iteration to the correct one:

odoo.define('tko_hr_attendance.script', function(require) {
"use strict";

var core = require('web.core');
var Model = require('web.Model');
var Widget = require('web.Widget');

var QWeb = core.qweb;
var _t = core._t;


instance.web.WebClient.include({


    init: function (parent, action) {
        this._super.apply(this, arguments);
        this.next_action = 'mail.mail_channel_action_client_chat';
        return this._super();
        },
    });
});

And this is my xml:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <template id="assets_backend_custom_id" name="tko_hr_attendance assets" inherit_id="web.assets_backend">
        <xpath expr="." position="inside">
            <script type="text/javascript" src="/tko_hr_attendance/static/src/js/script.js"></script>
        </xpath>
    </template>
</odoo>

I tried the following examples from odoo 8, 9, and 10, but I don’t think that they are applicable to the specific change that I am trying to make, or I either do not fully understand how the changes are applied.

Any help is appreciated, thanks.

+4
source share
1 answer

, , .

   core.action_registry.add('hr_attendance_kiosk_confirm', KioskConfirm);

action_registry, , .

            var  KioskConfirm = core.action_registry.get('hr_attendance_kiosk_confirm');

include init, super.

       KioskConfirm.include({
                       init : function (){
                              this._super.applay(this, arguments)
                               //.your code here 
                      }
         });

, javascript unoo , , .

+1

Source: https://habr.com/ru/post/1686550/


All Articles