Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
3361 Näkymät

hi all,

can i add a Many2one field in a model which will not save data in the database like computed field or related field where we can define store=False or store=True? if yes, how? 

OR

any other idea to have Many2one field which will not store data in database?

regards


Avatar
Hylkää
Paras vastaus

you can define many2one field as non stored field like

order_id = fields.Many2one('sale.order', compute="_compute_order_id")

def _compute_order_id(self):
for record in self:
# get/compute order_id from other field or based on your business logic
record.order_id = 2
Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
huhtik. 23
2873
2
helmik. 25
40663
2
marrask. 22
2917
1
helmik. 22
7938
2
jouluk. 21
4209