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

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 ")




Awatar
Odrzuć
Najlepsza odpowiedź

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.


Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

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

Regards

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
kwi 25
1382
Odoo App Rozwiązane
1
lis 23
1950
0
maj 24
1678
0
wrz 23
2633
0
wrz 23
2248