我想将数据库从一台计算机迁移到另一台计算机。我下载了备份并将所有已安装的模块传输到此计算机。但是当我进入数据库时,我得到一个错误:
引发QWebException(“呈现编译AST、e、path、node和etree.tostring(node[0],encoding='unicode'),name)时出错)odoo.addons.base.models.qweb.QWebException:“res.users”对象没有属性“sidebar\u type”回溯(最近一次调用):File“c:\program files(x86)\odoo 12.0\server\odoo\addons\base\models\qweb.py”,第346行,在编译的 返回编译(self、append、new、options、log)文件“”,第1行,在模板_178_234文件“”,第2行,在body_call_content_233; AttributeError:“res.users”对象没有属性“sidebar_type”错误以呈现编译AST AttributeError:“res.users”对象没有属性“sidebar_type”模板:178路径:/templates/t/t/t[4] 节点:<;t t-set=“body_classname”t-value=“'o_web_client mk_sidebar_type”+request.env.user.sidebar_type或'large'”/>
我看了看这个地方。此muk_web_主题模块:
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="webclient_bootstrap" name="Web Client" inherit_id="web.webclient_bootstrap">
<xpath expr="//t[@t-set='body_classname']" position="after">
<t t-set="body_classname" t-value="'o_web_client mk_sidebar_type_' + request.env.user.sidebar_type or 'large'"/>
</xpath>
<xpath expr="//*[hasclass('o_main')]" position="attributes">
<attribute name="t-attf-class">o_main mk_chatter_position_#{request.env.user.chatter_position or 'normal'}</attribute>
</xpath>
</template>
</odoo>
from odoo import models, fields, api
class ResUsers(models.Model):
_inherit = 'res.users'
#----------------------------------------------------------
# Defaults
#----------------------------------------------------------
@api.model
def _default_sidebar_type(self):
return self.env.user.company_id.default_sidebar_preference or 'small'
@api.model
def _default_chatter_position(self):
return self.env.user.company_id.default_chatter_preference or 'sided'
#----------------------------------------------------------
# Database
#----------------------------------------------------------
sidebar_type = fields.Selection(
selection=[
('invisible', 'Invisible'),
('small', 'Small'),
('large', 'Large')
],
required=True,
string="Sidebar Type",
default=lambda self: self._default_sidebar_type())
chatter_position = fields.Selection(
selection=[
('normal', 'Normal'),
('sided', 'Sided'),
],
required=True,
string="Chatter Position",
default=lambda self: self._default_chatter_position())
#----------------------------------------------------------
# Setup
#----------------------------------------------------------
def __init__(self, pool, cr):
init_res = super(ResUsers, self).__init__(pool, cr)
type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
type(self).SELF_WRITEABLE_FIELDS.extend(['sidebar_type'])
type(self).SELF_WRITEABLE_FIELDS.extend(['chatter_position'])
type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)
type(self).SELF_READABLE_FIELDS.extend(['sidebar_type'])
type(self).SELF_READABLE_FIELDS.extend(['chatter_position'])
return init_res
有什么问题吗
检查模块是否对odoo可见。迁移时,模块版本应保持不变
尝试使用空基,看看初始化数据库后是否有任何错误
尝试将模块安装到空基座
相关问题 更多 >
编程相关推荐