On OpenERP 8 (Odoo), I'm developing a module that should add a field Related Products, it should relate products both ways. I added a many2many field
在OpenERP 8(Odoo)上,我正在开发一个应该添加字段相关产品的模块,它应该以两种方式关联产品。我添加了一个很多2字段
class product_template(osv.Model):
_name = 'product.template'
_inherit = 'product.template'
_columns = {
'related_products': fields.many2many('product.template', 'rel_related_product', 'product_id', string="Related Products"),
}
The problem is that I can relate the product only one way. I.e. if I relate ProductB to ProductA, I can only see the relationship inside ProductA and not the otherway around
问题是我只能通过一种方式联系产品。即如果我将ProductB与ProductA联系起来,我只能看到ProductA内部的关系,而不是其他方面
How can I solve that?
我怎么解决这个问题?
2 个解决方案
#1
1
Why cant you use one2many relation. Like parent child relation in categories. Or you may be trying to get something similar to the bom structure. Please install the MRP module and check how bom structure is defined
为什么你不能使用one2many关系。像父类子关系一样。或者你可能试图获得类似于bom结构的东西。请安装MRP模块并检查bom结构的定义方式
#2
0
use this
用这个
class product_template(osv.Model):
_name = 'product.template'
_inherit = 'product.template'
_columns = {
'related_products': fields.many2many('product.template', 'rel_related_product', 'product_id', 'product_template_id', string="Related Products"),
}
#1
1
Why cant you use one2many relation. Like parent child relation in categories. Or you may be trying to get something similar to the bom structure. Please install the MRP module and check how bom structure is defined
为什么你不能使用one2many关系。像父类子关系一样。或者你可能试图获得类似于bom结构的东西。请安装MRP模块并检查bom结构的定义方式
#2
0
use this
用这个
class product_template(osv.Model):
_name = 'product.template'
_inherit = 'product.template'
_columns = {
'related_products': fields.many2many('product.template', 'rel_related_product', 'product_id', 'product_template_id', string="Related Products"),
}