Odoo 11通过初始化数据库给eror

时间:2018-11-13 07:06:29

标签: python-3.6 odoo-11

我有这样的.py代码

# -*- coding: utf-8 -*-
from odoo import models, fields, api
class Contract_Custom(models.Model):
_inherit = 'hr.contract'

def get_warning(self):
    contact = self.env['hr.contract'].search([])
    print(contact)
    i = 0
    while i < len(contact):
        print(type(contact[i].date_end))
        i =i +1

我的xml文件是这样的

<?xml version="1.0" encoding="utf-8"?>
<odoo>
   <data>

    <record id="EPS_FORM_HR_contract_CUSTOM" model="ir.ui.view">
        <field name="name">EPS custom HR form</field>
        <field name="model">hr.contract</field>
        <field name="inherit_id" ref="hr_contract.hr_contract_view_form"/>
        <field name="arch" type="xml">
             <xpath expr="//sheet" position="before">
                     <header>
                       <button name="get_warning" string="test" type="object" class="oe_highlight"/>
                     </header>
            </xpath>
        </field>
    </record>

</data>
</odoo>

当我第一次安装模块时,它运行得很好,但是当我修复代码以提高功能并更新模型时,它向我显示了这样的错误。

CRITICAL mydatabase_name odoo.service.server: Failed to initialize database `mydatabase_name`.

我该如何解决,我尝试了很多方法,但没有任何改变

预先感谢

0 个答案:

没有答案