コンテンツへスキップ
メニュー
この質問にフラグが付けられました

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!

関連投稿 返信 ビュー 活動
1
5月 23
2196
0
6月 22
1392
1
9月 23
2156
2
4月 23
6195
3
12月 19
5784