问题是我已将模块版本15升级到版本17
“odoo”标题显示在浏览器选项卡上,例如我打开了 odoo 本地服务器,然后单击了销售模块,然后您看到“Odoo-Quotation”或“Odoo-App”,所以我想删除“odoo”浏览器页面上的标题和下面的代码没有显示任何错误,但“Odoo”标题仍然显示为什么?
/** @odoo-module */
import { WebClient } from "@web/webclient/webclient";
import { patch } from "@web/core/utils/patch";
import { session } from "@web/session";
import { useService } from "@web/core/utils/hooks";
patch(WebClient.prototype, {
"legion_hide_odoo_tab.WebClient": {
setup() {
this._super.apply(this, arguments);
this.rpc = useService("rpc");
var domain = session.user_companies.allowed_companies;
this.title.setParts({ zopenerp: "" });
var obj = this;
var def = rpc.query({
fields: ['name','id',],
model: 'res.config.settings',
method: 'current_company_id',
args: [domain, domain],
})
.then(function (result) {
// const app_system_name = session.app_system_name || 'New title';
const app_system_name = session.app_system_name || '';
obj.title.setParts({ zopenerp: result });
});
}
}
});
在 Odoo 17 中,您不需要路径名。您可以在修补代码部分找到更多详细信息:
patch(object, {
fn() {
super.fn(...arguments);
// do other things
},
});
遗留的
rpc
已被删除。检查 remove Legacy rpc 提交,您将找到有关如何替换旧代码的示例。
您可以使用标题服务读取/修改文档标题