コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
5218 ビュー

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)


アバター
破棄
関連投稿 返信 ビュー 活動
7
11月 15
14217
0
9月 17
3841
3
9月 24
1421
0
12月 23
1354
0
10月 21
2946