【问题标题】:Migrate base odoo12迁移基础odoo12
【发布时间】: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

可能是什么问题?

【问题讨论】:

    标签: python xml odoo-12


    【解决方案1】:

    检查模块是否对 odoo 可见。迁移时模块版本应保持不变。

    在初始化数据库后尝试空基,看看是否有任何错误。

    尝试将你的模块安装到空基地。

    【讨论】:

    • Paxmees,所有模块的版本都是一样的。我尝试了您建议的变体。-> 没有错误
    • 转储是否完全转储? Odoo 的 GUI 数据库管理器可能不提供完整转储。它与更大的数据库制动。可能需要使用 PSQL 工具来复制数据库。
    • Paxmees,我试过了。我得到两个文件:filestore.tar 和 database.tar,但我可以在 Windows 操作系统上恢复 db。当我输入命令时: pg_restore -C -U postgres -d path_to_filestore -v path_to_database -W 我得到:“输入文件看起来不像存档”
    • 一切正常。其中一个模块的版本不匹配
    猜你喜欢
    • 1970-01-01
    • 2022-12-03
    • 1970-01-01
    • 2013-07-06
    • 2022-11-25
    • 2016-01-14
    • 1970-01-01
    • 1970-01-01
    • 2015-08-08
    相关资源
    最近更新 更多