【发布时间】:2020-07-28 10:52:56
【问题描述】:
我想将数据库从一台计算机迁移到另一台计算机。我下载了备份并将所有已安装的模块转移到这台计算机上。但是当我进入数据库时,我得到一个错误:
raise QWebException("Error to render compiling AST", e, path, node and etree.tostring(node[0], encoding='unicode'), name) odoo.addons.base.models.qweb.QWebException: 'res.users' 对象没有属性 'sidebar_type' Traceback(最近一次调用最后):文件“c:\program files (x86)\odoo 12.0\server\odoo\addons\base\models\qweb.py”,第 346 行,在 compiled_fn 中 返回已编译(self,append,new,options,log)文件“”,第 1 行,在 template_178_234 文件“”,第 2 行,在 body_call_content_233 中 AttributeError: 'res.users' 对象没有属性 'sidebar_type' 渲染编译 AST 时出错AttributeError:“res.users”对象没有属性“sidebar_type”模板:178 路径:/templates/t/t/t[4] 节点:' + request.env.user.sidebar_type or 'large'"/> - - -
我看着这个地方。这个 muk_web_theme 模块:
<?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
可能是什么问题?
【问题讨论】: