Skip to Content
Menu
This question has been flagged
1 Reply
6684 Views

Odoo v10

I want to modify this in abstract_web_client.js:


var WebClient = Widget.extend({    
[...]
init: function(parent) {        this.client_options = {};
        this._super(parent);
        this.origin = undefined;
        this._current_state = null;
        this.menu_dm = new utils.DropMisordered();
        this.action_mutex = new utils.Mutex();
        this.set('title_part', {"zopenerp": "Odoo"});
    },
[...]
});


Replacing init: function with this:


var WebClient = Widget.extend({   
[...]
init: function(parent) {       
this.client_options = {};
        this._super(parent);
        this.origin = undefined;
        this._current_state = null;
        this.menu_dm = new utils.DropMisordered();
        this.action_mutex = new utils.Mutex();
        this.set('title_part', {"zopenerp": "MyCustomerName"});
    },
[...]
});


I have tried to define a new .JS in my module -/my_module/static/src/js/abstract_web_client.js- with the following code:

 

odoo.define('my_module.AbstractWebClient', function (require) {"use strict";
    var AbstractWebClient = require('web.AbstractWebClient');
 
    AbstractWebClient.include({
        init: function(parent) {
            this.client_options = {};
            this._super(parent);
            this.origin = undefined;
            this._current_state = null;
            this.menu_dm = new utils.DropMisordered();
            this.action_mutex = new utils.Mutex();
            this.set('title_part', {"zopenerp": "MyCustomerName"});
        },
    });
});



And include later in via xml file:

 

<template id="my_module_assets_backend" inherit_id="web.assets_backend">
        <xpath expr="//script[last()]" position="after">
            <script type="text/javascript" src="/my_module/static/src/js/abstract_web_client.js"></script>
        </xpath>
</template>


But now Odoo interface web get stucks.


Any tips on what is wrong?






Avatar
Discard
Best Answer

Hi, 

Here what i have done

In js,

odoo.define('your_module_name.AbstractWebClient', function (require) {
'use strict';
var mixins = require('web.mixins');
var concurrency = require('web.concurrency');
var AbstractWebClient = require('web.AbstractWebClient');

AbstractWebClient.include({
init: function (parent) {
this.client_options = {};
mixins.ServiceProvider.init.call(this);
this._super(parent);
this.origin = undefined;
this._current_state = null;
this.menu_dm = new concurrency.DropMisordered();
this.action_mutex = new concurrency.Mutex();
this.set('title_part', {"zopenerp": ""});
},
});
});

In xml,


<odoo>
<data>
<template id="web_layout" name="Web Layout" inherit_id="web.layout">
<xpath expr="//html" position="replace">
<html t-att="html_data or {}">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/>

<title t-esc="title"/>

<script type="text/javascript">
var odoo = {
csrf_token: "<t t-esc="request.csrf_token(None)"/>",
};
</script>

<t t-raw="head or ''"/>
</head>
<body t-att-class="body_classname">
<t t-raw="0"/>
</body>
</html>
</xpath>
</template>

<template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script
src="/hide_logo_title/static/src/js/abstract_web_client.js"
type="text/javascript"
/>
</xpath>
</template>
</data>
</odoo>
Hope this will work.
Thanks.

Avatar
Discard
Related Posts Replies Views Activity
0
Dec 17
3210
1
Jun 24
316
1
Jul 19
2608
0
May 18
2078
4
Apr 18
4490