跳至內容
選單
此問題已被標幟
2 回覆
1944 瀏覽次數

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




頭像
捨棄
最佳答案

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.


頭像
捨棄
最佳答案

Hi,

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

Regards

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
4月 25
1384
Odoo App 已解決
1
11月 23
1950
0
5月 24
1679
0
9月 23
2636
0
9月 23
2248