Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1850 Visualizações

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?

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
1
out. 18
4738
1
mar. 24
1529
0
abr. 21
4
1
abr. 21
2412
2
set. 24
1485