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

Hi, I'd like to show intrastat_id field that is on product form in account move (when creating invoices)

I'm inheriting it like this


class ProductTemplate(models.Model):
_inherit = 'account.move.line'
 
product_template_id = fields.Many2one('product.template')
intra_stat = fields.Many2one(related="product_template_id.intrastat_id", string='Intrastat #')

It shows nothing - blank field in lines. What am I doing wrong? I double checked if Intrastat is set on product.

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

Hello @Matija

Did you set a value for product_template_id in your account_move_line?

Otherwise, I think you don't have to create a new field 'product_template_id', you just have to set intra_stat field as related to product_id of account.move.line.

intra_stat = fields.Many2one(related="product_id.intrastat_id", string='Intrastat #')

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

You're right Samuel, this related="product_id.intrastat_id" works. Thank you for your help!

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ค. 23
2227
0
มิ.ย. 22
1426
1
ก.ย. 23
2217
2
เม.ย. 23
6227
Acces field of other product.template แก้ไขแล้ว
3
ธ.ค. 19
5833