Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
2376 Lượt xem
My goal is to change the Page title using the company name. I am trying to change the function but stil there's no effect. Any idea on how to achieve this?

varsession = require('web.session');
varAbstractWebClient = require('web.AbstractWebClient');
AbstractWebClient.include({
_title_changed:function () {
this._super();
var company_name = session.user_companies.current_company[1];
document.title = company_name;console.log('_title_changed function');
},
});


Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Hi, This is what I did and it's working fine on my end:


odoo.define('mymodule.AbstractWebClient', function (require) {
"use strict";
/**
* AbstractWebClient Override Method for Page Title using Company Name
*/

var session = require('web.session');
var AbstractWebClient = require('web.AbstractWebClient');

AbstractWebClient.include({
_title_changed:function () {
this._super();
var company_name = session.user_companies.current_company[1];
document.title = company_name;
},
});

return AbstractWebClient;
});

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi, 
Show us the declaration of your js file.
Then add console.log('==========') after var session line to check if odoo reads the file
then add another one inside yuour fnution to check if it's printed too.

waiting for your reply.

Regards.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 23
3010
0
thg 5 23
3257
1
thg 1 23
8039
1
thg 10 22
3704
Override JS mail Đã xử lý
3
thg 7 21
5314