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

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?

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
ODOO Studio Calculate แก้ไขแล้ว
1
ต.ค. 18
4742
1
มี.ค. 24
1534
0
เม.ย. 21
4
1
เม.ย. 21
2412
2
ก.ย. 24
1495