首页 > 解决方案 > 当我更改权限文件 ir.model.access.csv 并升级模块时,我有一个问题缺少字段“对象”(model_id) 的必需值

问题描述

我在 odoo 12 中创建了自己的模块。并且我更改了权限文件- ir.model.access.csv. 所有代码如下。

ir.model.access.csv:

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_customer_customer,access.customer.customer,model_customer_customer,base.group_user,1,1,1,0

.模型/模型:

from odoo import models, fields

class CustomerCustomer(models.Model):

    _name = 'customer.customer'


    name = fields.Char(string= 'Name', required=True)
    place = fields.Char(string='Place')
    photo = fields.Binary(string='Image')
    age = fields.Integer(string='Age')
    dob = fields.Date(string='Date of Birth')

当我尝试升级我的模块并安装我从 odoo 12 创建的模块时出现错误消息

异常:模块加载 custom_customer 失败:文件 custom_customer\security/ir.model.access.csv 无法处理:在字段 'Object' 中找不到外部 id 'model_customer_customer' 的匹配记录缺少字段'Object'的必需值(model_id )

标签: pythonmodulepermissionsupgradeodoo-12

解决方案


请检查您是否在模型文件夹内的init .py中添加了文件名,并请检查是否在主init .py 文件中添加了模型文件夹


推荐阅读