关于关系性m2m,m2o,o2m求大佬们教一下
-
project': fields.many2many('project.project', string="Project", select=True, track_visibility='onchange',required=True), # 项目名称 'voucher': fields.many2one('voucher', 'Voucher', select=True, track_visibility='onchange'), 'voucher_number': fields.text('Voucher Number', select=True, track_visibility='onchange'), 'end_user': fields.many2many('res.partner', 'coordination_order_end_user_rel', 'name', string="The End User",domain="[('is_company','=',True)]", select=True, track_visibility='onchange', required=True), # 最终用户 The end user 'contract_number': fields.char('Contract Number', size=128, select=True, track_visibility='onchange'), # 合同数量 'hardware_vendor': fields.many2one('res.partner', 'Hardware Vendor', domain="[('is_company','=',True)]",select=True, track_visibility='onchange'), # 硬件供应商 create_receive_proof_id = self.browse(cr, uid, ids[0]) coordination_order_id = self.pool['work.coordination.order'].browse(cr, uid, active_ids, context=context) receive_proof = self.read(cr, uid, ids, ['type', 'receive_company'], context=context) create_receive_proof_ids.append((0, 0, {'type': receive_proof[0]['type'], 'receive_company': receive_proof[0]['receive_company']})) get_product_receive_prove = self.pool.get('product.receive.prove') addenda_related = self.pool.get('addenda') parm = { 'coordination_order': coordination_order_id.id, 'is_reinstall': coordination_order_id.reload_coordination_order, 'supply_company': coordination_order_id.hardware_vendor.id, 'receive_company': create_receive_proof_id.receive_company.id, 'contact': coordination_order_id.project_contact, 'contact_telephone': coordination_order_id.contact_telephone, 'product': coordination_order_id.product, 'task_type': coordination_order_id.task_type, 'type': receive_proof[0]['type'], 'report_name': '产品接收证明' }
我用many2one用的 .id 都能存入表中,但是one2many和many2many用 .id 去 存就不行,就报错了
求大佬,教一下,我该怎么去存啊 -
'product': fields.many2many('product.product', string="Product", track_visibility='onchange'), # 产品名称 'contact': fields.many2many('res.partner', 'receive_prove_contact_rel', 'name', domain="[('is_company','=',False)]", string="Contact", select=True,track_visibility='onchange'), # 联系人 'contact_telephone': fields.char('Contact Telephone', size=256, select=True, track_visibility='onchange'),# 联系方式 'contract': fields.char('Contract', size=64, select=True, track_visibility='onchange'), # 合同号 'contract_number': fields.char('Contract Number', size=128, select=True, track_visibility='onchange'), # 合同数量 'task_type': fields.many2many('coordination.task.type', 'asw_rel', 'name', select=True, string="Task Type",track_visibility='onchange'), # 任务分类