2017-07-30 9 views
0

タイトルの名前を変更しようとしています。 JS関数を継承しようとしましたが、コンソールでエラーが発生しました。Inherit JS in Odoo 10

error: Some modules could not be started 
Failed modules:   Array [ "web.web_client" ] 
Non loaded modules:  Array [ "web.ChangePassword", "web.Apps", 
"account.reconciliation", "mail.chat_client_action", 
"mail.ExtendedChatWindow", "mail.composer", "mail.chat_manager", 
"mail.Chatter", "mail.systray", "mail.utils", 3 more… ] 
Debug:     Object { web.ChangePassword: Object, 
web.Apps: Object, account.reconciliation: Object, 
mail.chat_client_action: Object, mail.ExtendedChatWindow: Object, 
mail.composer: Object, mail.chat_manager: Object, mail.Chatter: 
Object, mail.systray: Object, mail.utils: Object, 4 more… } 

の.js

odoo.define('sharpos_data', function(require){ 
"use strict"; 
var WebClient = require('web.WebClient'); 
WebClient.include({ 
init: function(parent) { 
    console.log('Shar POSS jS'); 
    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": "Shar POS JS"}); 
} 
}); 
}); 

どのように私はこの問題を解決することができますか?

答えて

1

あなたはこのように、この場合には、「utilsの」すべての必要な変数を定義する必要があります。私たちはyour.IへのMicrocomの答えはあなたの答えを編集した@追加する必要があり

var utils = require('web.utils'); 
1
var WebClient = require('web.AbstractWebClient'); 
var Model = require('web.Model'); 
var utils = require('web.utils'); 
WebClient.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(); 
     var self = this; 
     /*put the company name Here, replace xxxxxxxxxx*/ 
     new Model("website").call("search_read",[[], ['company_name']]).then(function (res) { 
      self.set('title_part', {"zopenerp": res && res[0] && res[0].company_name || ''}); 
     }); 
    }, 
}); 
+0

。ありがとうビルマ。 – KbiR