Error:
Odoo Server Error
Traceback (most recent call last):
File "F:odoo-14.0odoo-14.0odootoolsconvert.py", line 677, in _tag_root
f(rec)
File "F:odoo-14.0odoo-14.0odootoolsconvert.py", line 655, in _tag_template
return self._tag_record(record)
File "F:odoo-14.0odoo-14.0odootoolsconvert.py", line 580, in _tag_record
record = model._load_records([data], self.mode == 'update')
File "F:odoo-14.0odoo-14.0odoomodels.py", line 4213, in _load_records
records = self._load_records_create([data['values'] for data in to_create])
File "F:odoo-14.0odoo-14.0odoomodels.py", line 4142, in _load_records_create
return self.create(values)
File "<decorator-gen-43>", line 2, in create
File "F:odoo-14.0odoo-14.0odooapi.py", line 345, in _model_create_multi
return create(self, arg)
File "F:odoo-14.0odoo-14.0odooaddonsbasemodelsir_ui_view.py", line 482, in create
return super(View, self).create(vals_list)
File "<decorator-gen-65>", line 2, in create
File "F:odoo-14.0odoo-14.0odooapi.py", line 345, in _model_create_multi
return create(self, arg)
File "F:odoo-14.0odoo-14.0odooaddonsbasemodelsir_fields.py", line 534, in create
recs = super().create(vals_list)
File "<decorator-gen-13>", line 2, in create
File "F:odoo-14.0odoo-14.0odooapi.py", line 345, in _model_create_multi
return create(self, arg)
File "F:odoo-14.0odoo-14.0odoomodels.py", line 3903, in create
fields[0].determine_inverse(batch_recs)
File "F:odoo-14.0odoo-14.0odoofields.py", line 1185, in determine_inverse
getattr(records, self.inverse)()
File "F:odoo-14.0odoo-14.0odooaddonsbasemodelsir_ui_view.py", line 300, in _inverse_arch
view.write(data)
File "F:odoo-14.0odoo-14.0odooaddonsbasemodelsir_ui_view.py", line 500, in write
res = super(View, self).write(self._compute_defaults(vals))
File "F:odoo-14.0odoo-14.0odoomodels.py", line 3687, in write
real_recs._validate_fields(vals, inverse_fields)
File "F:odoo-14.0odoo-14.0odoomodels.py", line 1266, in _validate_fields
check(self)
File "F:odoo-14.0odoo-14.0odooaddonsbasemodelsir_ui_view.py", line 411, in _check_xml
)).with_traceback(e.__traceback__) from None
File "F:odoo-14.0odoo-14.0odooaddonsbasemodelsir_ui_view.py", line 385, in _check_xml
view_def = view.read_combined(['arch'])
File "F:odoo-14.0odoo-14.0odooaddonsbasemodelsir_ui_view.py", line 809, in read_combined
arch = root.apply_view_inheritance(arch_tree, self.model)
File "F:odoo-14.0odoo-14.0odooaddonsbasemodelsir_ui_view.py", line 750, in apply_view_inheritance
return self._apply_view_inheritance(source, inherit_tree)
File "F:odoo-14.0odoo-14.0odooaddonsbasemodelsir_ui_view.py", line 758, in _apply_view_inheritance
source = view.apply_inheritance_specs(source, arch_tree)
File "F:odoo-14.0odoo-14.0odooaddonsbasemodelsir_ui_view.py", line 735, in apply_inheritance_specs
self.handle_view_error(str(e))
File "F:odoo-14.0odoo-14.0odooaddonsbasemodelsir_ui_view.py", line 673, in handle_view_error
raise ValueError(formatted_message).with_traceback(from_traceback) from from_exception
odoo.exceptions.ValidationError: Error while validating view:
Element '<xpath expr="//script[last()]">' cannot be located in parent view
View name: QUnit Assets
Error context:
view: ir.ui.view(1033,)
xmlid: qunit_suite
view.parent: ir.ui.view(199,)
file: f:odoo-14.0odoo-14.0custommuk_web_utilstemplateassets.xml
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "F:odoo-14.0odoo-14.0odooaddonsbasemodelsir_http.py", line 237, in _dispatch
result = request.dispatch()
File "F:odoo-14.0odoo-14.0odoohttp.py", line 684, in dispatch
result = self._call_function(**self.params)
File "F:odoo-14.0odoo-14.0odoohttp.py", line 360, in _call_function
return checked_call(self.db, *args, **kwargs)
File "F:odoo-14.0odoo-14.0odooservicemodel.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "F:odoo-14.0odoo-14.0odoohttp.py", line 348, in checked_call
result = self.endpoint(*a, **kw)
File "F:odoo-14.0odoo-14.0odoohttp.py", line 913, in __call__
return self.method(*args, **kw)
File "F:odoo-14.0odoo-14.0odoohttp.py", line 532, in response_wrap
response = f(*args, **kw)
File "f:odoo-14.0odoo-14.0addonswebcontrollersmain.py", line 1393, in call_button
action = self._call_kw(model, method, args, kwargs)
File "f:odoo-14.0odoo-14.0addonswebcontrollersmain.py", line 1381, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "F:odoo-14.0odoo-14.0odooapi.py", line 396, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "F:odoo-14.0odoo-14.0odooapi.py", line 383, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-72>", line 2, in button_immediate_install
File "F:odoo-14.0odoo-14.0odooaddonsbasemodelsir_module.py", line 74, in check_and_log
return method(self, *args, **kwargs)
File "F:odoo-14.0odoo-14.0odooaddonsbasemodelsir_module.py", line 475, in button_immediate_install
return self._button_immediate_function(type(self).button_install)
File "F:odoo-14.0odoo-14.0odooaddonsbasemodelsir_module.py", line 593, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "F:odoo-14.0odoo-14.0odoomodulesregistry.py", line 89, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "F:odoo-14.0odoo-14.0odoomodulesloading.py", line 460, in load_modules
loaded_modules, update_module, models_to_check)
File "F:odoo-14.0odoo-14.0odoomodulesloading.py", line 348, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "F:odoo-14.0odoo-14.0odoomodulesloading.py", line 221, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package)
File "F:odoo-14.0odoo-14.0odoomodulesloading.py", line 69, in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind)
File "F:odoo-14.0odoo-14.0odootoolsconvert.py", line 733, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate)
File "F:odoo-14.0odoo-14.0odootoolsconvert.py", line 799, in convert_xml_import
obj.parse(doc.getroot())
File "F:odoo-14.0odoo-14.0odootoolsconvert.py", line 719, in parse
self._tag_root(de)
File "F:odoo-14.0odoo-14.0odootoolsconvert.py", line 685, in _tag_root
)) from e
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "F:odoo-14.0odoo-14.0odoohttp.py", line 640, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "F:odoo-14.0odoo-14.0odoohttp.py", line 316, in _handle_exception
raise exception.with_traceback(None) from new_cause
odoo.tools.convert.ParseError: while parsing None:73, near
<data name="QUnit Assets" inherit_id="web.qunit_suite">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_utils/static/tests/fields.js"/>
</xpath>
</data>
and here is my code:
/**********************************************************************************
*
* Copyright (c) 2017-2019 MuK IT GmbH.
*
* This file is part of MuK Web Utils
* (see https://mukit.at).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
**********************************************************************************/
odoo.define('muk_web_utils.tests.fields', function (require) {
"use strict";
var basicFields = require('web.basic_fields');
var concurrency = require('web.concurrency');
var config = require('web.config');
var core = require('web.core');
var FormView = require('web.FormView');
var KanbanView = require('web.KanbanView');
var ListView = require('web.ListView');
var session = require('web.session');
var testUtils = require('web.test_utils');
var field_registry = require('web.field_registry');
var createView = testUtils.createView;
var createAsyncView = testUtils.createAsyncView;
var DebouncedField = basicFields.DebouncedField;
var JournalDashboardGraph = basicFields.JournalDashboardGraph;
var _t = core._t;
QUnit.module('muk_web_utils', {}, function () {
QUnit.module('fields', {
beforeEach: function () {
this.data = {
partner: {
fields: {
display_name: {
string: "Displayed name",
type: "char",
searchable: true
},
short: {
string: "Short",
type: "char",
searchable: true,
trim: true
},
long: {
String: "Long",
string: "txt",
type: "text",
},
document: {
string: "Binary",
type: "binary",
attachment: true,
},
},
records: [{
id: 1,
display_name: "first record",
short: "Short Text",
long: "Super looooooong Text",
document: 'coucou==n',
}],
},
};
}
}, function () {
QUnit.module('BinaryFileCopy');
QUnit.test('Fields is correctly rendered', function (assert) {
assert.expect(2);
var form = createView({
View: FormView,
model: 'partner',
data: this.data,
arch: (
'<form string="Partners">' +
'<field name="document" widget="copy_binary" filename="short"/>' +
'<field name="short"/>' +
'</form>'
),
res_id: 1,
});
assert.strictEqual(
form.$('a.o_field_widget[name="document"] > .mk_copy_binary > .mk_copy_button').length,
1, "the copy button should be visible in readonly mode"
);
form.$buttons.find('.o_form_button_edit').click();
assert.strictEqual(
form.$('a.o_field_widget[name="document"] > .mk_copy_binary').length,
0, "the copy button shouldn't be visible in edit mode"
);
form.destroy();
});
QUnit.module('CharShare');
QUnit.test('Fields is correctly rendered', function (assert) {
assert.expect(1);
var form = createView({
View: FormView,
model: 'partner',
data: this.data,
arch: (
'<form string="Partners">' +
'<div>' +
'<field name="short" widget="share_char"/>' +
'</div>' +
'</form>'
),
res_id: 1,
});
assert.strictEqual(
form.$('span.o_field_widget[name="short"] > .mk_share_dropdown.mk_share_char').length,
1, "the copy button should be visible in readonly mode"
);
form.destroy();
});
QUnit.module('TextShare');
QUnit.test('Fields is correctly rendered', function (assert) {
assert.expect(1);
var form = createView({
View: FormView,
model: 'partner',
data: this.data,
arch: (
'<form string="Partners">' +
'<div>' +
'<field name="long" widget="share_text"/>' +
'</div>' +
'</form>'
),
res_id: 1,
});
assert.strictEqual(
form.$('span.o_field_widget[name="long"] > .mk_share_dropdown.mk_share_text').length,
1, "the copy button should be visible in readonly mode"
);
form.destroy();
});
QUnit.module('BinaryFileShare');
QUnit.test('Fields is correctly rendered', function (assert) {
assert.expect(2);
var form = createView({
View: FormView,
model: 'partner',
data: this.data,
arch: (
'<form string="Partners">' +
'<field name="document" widget="share_binary" filename="short"/>' +
'<field name="short"/>' +
'</form>'
),
res_id: 1,
});
assert.strictEqual(
form.$('a.o_field_widget[name="document"] > .mk_share_dropdown > .mk_share_button').length,
1, "the share dropdown should be visible in readonly mode"
);
form.$buttons.find('.o_form_button_edit').click();
assert.strictEqual(
form.$('a.o_field_widget[name="document"] > .mk_share_dropdown > .mk_share_button').length,
0, "the share dropdown shouldn't be visible in edit mode"
);
form.destroy();
});
});
});
});
当我将这个模块从odoo 12升级到odoo 14时,发生了这个错误。当我改变xpath并安装这个模块时,它显示了一个错误类型:view.getcontroller(....)。Guardedcatch不是一个函数。我不知道这个错误我怎么能修复它,在我的代码中,我需要改变,请帮助我。
<xpath expr="//script[last()]" position="after">
Odoo无法获得上述expr路径,因此请检查您的inherited_id在第十四节。
或者试着重写为:
<template id="qunit_suite" name="QUnit Assets" inherit_id="web.qunit_suite">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_utils/static/tests/fields.js" />
</xpath>
</template>