Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
3244 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
dub 23
2631
2
úno 25
40117
2
lis 22
2704
1
úno 22
7730
2
pro 21
3979