create根据给定值创建记录 (cr, user, vals, context=None) 参数: * cr —— 数据库游标 * user —— 当前用户id * vals —— 字段:值的字典 关系型字段的值用如下方式表示* many2many 字段 : [(6, 0, list of ids)] (example: [(6, 0, [8, 5, 6, 4])])* one2many 字段 : [(0, 0, dictionary of values)] (example: [(0, 0, {‘field_name’:field_value, ...})])* many2one 字段 : 关联记录的ID* reference 字段 : model name, id (例: ‘product.product, 5’)many2many 字段 : (0, 0, { values }) link to a new record that needs to be created with the given values dictionary (1, ID, { values }) update the linked record with id = ID (write values on it) (2, ID) remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well) (3, ID) cut the link to the linked record with id = ID (delete the relationship between the two objects but does not delete the target object itself)[size=24pt][color=red] (4, ID) link to existing record with id = ID (adds a relationship)[/color][/size] (5) unlink all (like using (3,ID) for all linked records) (6, 0, [IDs]) replace the list of linked IDs (like using (5) then (4,ID) for each ID in the list of IDs)one2many 字段: (0, 0, { values }) link to a new record that needs to be created with the given values dictionary (1, ID, { values }) update the linked record with id = ID (write values on it) (2, ID) remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well) * context —— 上下文,如语言、时区等 返回值: 新记录的id 异常: AccessError —— 如果用户没有创建这个对象的权限ValidateError —— 如果用户在字段中输入的值不在该字段的selection参数的范围内