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

I currently have a field called target price, and I want to take the product cost, divide it by a number and put the result in the filed.

This is my current script:

Field name: x_studio_target_price_1
Dependencies: standard_price
Compute: for record in self:
record[("x_studio_target_price_1)] = record.standard_price / 1.15

Standard_price is the field name for the cost in odoo product.template object. 

Whenever I use this script it doesn't give me any errors but nothing is being computed either. Can someone help?

อวตาร
ละทิ้ง
ผู้เขียน

@Chris TRINGHAM I don't have enough karma to comment to your post buy your solution worked! Thank you so much!

คำตอบที่ดีที่สุด

I got it working with this syntax: 

for record in self:
record['x_studio_target_price_1'] = record.standard_price / 1.15
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi!

Try to assign the 1.15 value to another field, for example, calling it "targetfactor"=1.15 

Then do:

record[("x_studio_target_price_1)] = record(standard_price)* record(targetfactor)


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
7
พ.ย. 15
14272
0
ก.ย. 17
3885
Simple Computed Field help แก้ไขแล้ว
3
ก.ย. 24
1454
0
ธ.ค. 23
1376
0
ต.ค. 21
2970