Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
10156 Widoki

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

Awatar
Odrzuć
Autor

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

Najlepsza odpowiedź

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.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
3
maj 25
1756
1
kwi 25
1295
3
wrz 24
14210
2
lut 24
2482
1
lip 23
2739