Odoo中文社区可以通过以下两个域名访问:shine-it.net , odoo.net.cn

由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解

本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

如果您登录系统碰到问题,请在微信公众号留言:

关于关系性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'),  # 任务分类
    

Log in to reply