Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
2211 มุมมอง

Hi all,

i have boolean field (x_visible_in_woo) defined in product.template and would like to show it inside stock.move.line

I created XML in which I called


As expected I get error "Field "x_visible_in_woo" does not exist in model "stock.move.line"

I'm aware i need to somehow connect this two fields in .py file but i'm not able to find any help - please if someone can guide me I would be very thankful. 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

You have to add a related field in stock move line model also.

Inherit the stock.move.line model and then define the related field.

x_visible_in_woo = fields.Char(related='product_id.x_visible_in_woo')


Thanks

อวตาร
ละทิ้ง
ผู้เขียน

Niyas, one more time you saved me - i knew that it needs to be inherited but couldn't figure out how to do it - thank you so much!

The only thing is that it's boolean field so it's fields.Boolean(related='product_id.x_visible_in_woo')

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ธ.ค. 24
1464
Import Data From Another Model แก้ไขแล้ว
1
มี.ค. 24
2515
1
มิ.ย. 23
12537
0
ม.ค. 23
3191
0
ธ.ค. 21
2048