Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2949 Lượt xem

Im trying to calculate total volume of order line in one field  using odoo studio

1 I activate mode dev 

2 I Added field

3 Idid this code python 

for record in self:

record['x_studio_float_field_21r_1h8gqq14n'] = sum([record.line.x_studio_volume for line in record.x_studio_volume])

  but it didnt work

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,


It looks like you're trying to calculate the total volume of order lines and display it in a field using Odoo Studio. However, there seems to be a mistake in your Python code. Here's the corrected code:


for record in self:

    record['x_studio_float_field_21r_1h8gqq14n'] = sum(line.x_studio_volume for line in record.order_line)


Hope it helps

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 2 23
7126
2
thg 12 21
5915
1
thg 4 25
4796
0
thg 8 19
2908
1
thg 10 22
2959