0

我创建了一个包含一些审计属性的视图:

class audit_performance(osv.Model):
_name = "audit.performance"
_auto = False
_description = "Audit performance Analysis"
_inherit = ["audit", "action"]

def init(self, cr):
    tools.drop_view_if_exists(cr, 'audit_performance')
    cr.execute("""
        CREATE OR REPLACE VIEW audit_performance AS (
            SELECT
                c.id,
                c.name,
                count(c.id) as nbr_cases,
                c.date_begin ,
                c.date_end ,
                c.user_id,
                c.audit_leader,
                c.audit_type,
                c.state as audit_state,
                c.company_id,
                a.state as action_state
            FROM
                audit c, action a
            GROUP BY c.id
        )""")

我创建了一个图表视图来查看审计的性能,一切正常,但当我添加操作状态时(我更改为 one2many 字段但它不起作用)。

这是审计模型:

class audit(orm.Model):
    _name = "audit"
    _description = "Audit"
    _inherit = ['mail.thread']
    _columns = {
       'name': fields.char('Name', size=50),
       'imp_opp_ids': fields.one2many(
        'action',
        'audit_id',
        'Related Actions',
    ),}

它不起作用,尽管模型中确实存在该字段,但它无法识别该字段。这是错误消息:

relation "action" does not exist    

目标是按其行动的状态对审计进行分类(所有行动的审计都已结束或尚未结束......),并了解跟踪审计。

4

0 回答 0