跳至内容
菜单
此问题已终结
1 回复
10238 查看

Hi,

How and when is dummy field used and can you explain in detail about dummy field.

The dummy field is defined in product.product object as:

'pricelist_id': fields.dummy(string='Pricelist', relation='product.pricelist', type='many2one'),

also why use dummy when you can use many2one field like:

'pricelist_id': fields.many2one('product.pricelist','Pricelist',),

Thanks in advance

形象
丢弃
编写者

and also used at stock.product_product for fields 'location_id','warehouse_id'.

最佳答案

fields.dummy  is like fields.function, but always return null value, when you read or when you search.

Dummy fields can be used for backward compatibility. E.g. you don't need pricelist_id field anymore, but some other modules have a reference to this field. So, instead of deleting field, you can replace one to dummy field.

形象
丢弃
相关帖文 回复 查看 活动
3
5月 25
1949
1
4月 25
1470
3
9月 24
14449
2
2月 24
2622
1
7月 23
2848