odoo中操作第三章表

自定义第三章表的表名,自身关联many2many

personal_or_company = fields.Many2many('res.partner','personal_or_company_rel','current_id','relation_id',string='Personal Company')

sql语句操作第三张表,增加数据

sql = """INSERT INTO personal_or_company_rel (current_id, relation_id)  
VALUES (19,24);"""
        request._cr.execute(sql)
        request._cr.commit()

查询

 sql = """SELECT * FROM personal_or_company_rel """
 request._cr.execute(sql)
result = request._cr.fetchall()

你可能感兴趣的:(odoo中操作第三章表)