Skip to Content
Menú
This question has been flagged
2 Respostes
1936 Vistes

odoo16
I added field one2many named 

location_id in product.template but why the value disappear when i select it and click on save?
class ProductTemplate(models.Model):
_inherit = 'product.template'
location_id = fields.Many2one('stock.location', string="Default location ")




Avatar
Descartar
Best Answer

Try one of these or both:


in .py:

location_id = fields.Many2one('stock.location', string="Default location ", store=True)

in .xml:

name="location_id" force_save="1"/>

The field will show for sure...

Thanks.


Avatar
Descartar
Best Answer

Hi,

Did you try giving store=True in python file? If that doesn’t work try giving force_save="1" in the xml.

Regards

Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
d’abr. 25
1382
Odoo App Solved
1
de nov. 23
1949
0
de maig 24
1677
0
de set. 23
2632
0
de set. 23
2248