So in Sales Order Line I added EIR. This is a monetary value. Now, I want to add a EIR Total below the Total field. How to do this? What code should I typed in to python 'for records in self'?
Thanks in advance!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
So in Sales Order Line I added EIR. This is a monetary value. Now, I want to add a EIR Total below the Total field. How to do this? What code should I typed in to python 'for records in self'?
Thanks in advance!
Hi,
for rec in self:
sum_of_lines = sum(rec.order_lines.mapped('field_name_in_order_line'))
rec.field_name = sum_of_lines
Thanks
Hi,
I am receiving an error:
Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/http.py", line 644, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/odoo/src/odoo/odoo/http.py", line 302, in _handle_exception
raise exception.with_traceback(None) from new_cause
ValueError: forbidden opcode(s) in "for records in self:\r\n sum_of_lines = sum(rec.order_lines.mapped('x_studio_eir'))\r\n record.x_studio_eir_total = sum_of_lines": STORE_ATTR
for records in self:
sum_of_lines = sum(rec.order_lines.order_line('x_studio_eir'))
record.x_studio_eir_total = sum_of_lines
seems you are using an automated action ?
then ,
for rec in records:
sum_of_lines = sum(rec.order_lines.mapped('field_name_in_order_line'))
rec['field_name'] = sum_of_lines
Hi Raphy,
You're a great help!
Its working now. A lot of thanks!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
0
thg 11 23
|
1381 | ||
Create order_line from code
Đã xử lý
|
|
1
thg 11 22
|
3909 | |
|
2
thg 6 22
|
3639 | ||
|
2
thg 3 24
|
4784 | ||
|
1
thg 3 23
|
2618 |