跳至内容
菜单
此问题已终结
1807 查看

Hi,


I want to add a field with Odoo Studio that shows one specific field of one specific line? In this case I have a sale order, which has multiple order lines, where I want to show the first product which has a specific product category.


Example:

  • I have a sale order with 5 order lines (5 different products)

  • One (or more) of those order lines has a product with the category "Omvormers". The product name = "Omvormer XYZ"

  • How can I create a field on the sale order showing the (first) product where category = "Omvormers"? Result should show: Omvormer XYZ

    I asked this question before and tried but still not answer working, what i have now:

    Dependency: order_line.product_id.categ_id
    Code:  for rec in self:

      line = rec.order_line.filtered(lambda l: l.product_id.categ_id == 'Omvormers')

      if line:

        rec['x_studio_type_omvormer_1'] = line[0].product_id

      else:

        rec['x_studio_type_omvormer_1'] = False

        

    What am I doing wrong?

形象
丢弃
相关帖文 回复 查看 活动
1
10月 18
4680
1
3月 24
1475
0
4月 21
4
1
4月 21
2361
2
9月 24
1427