Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
2 Besvarelser
1961 Visninger

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
Kassér
Bedste svar

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
Kassér
Bedste svar

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
Kassér
Related Posts Besvarelser Visninger Aktivitet
1
apr. 25
1392
1
nov. 23
1974
0
maj 24
1693
0
sep. 23
2653
0
sep. 23
2262