Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
2 Vastaukset
5115 Näkymät

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?

Avatar
Hylkää
Tekijä

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

Paras vastaus

I got it working with this syntax: 

for record in self:
record['x_studio_target_price_1'] = record.standard_price / 1.15
Avatar
Hylkää
Paras vastaus

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)


Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
7
marrask. 15
14064
0
syysk. 17
3741
3
syysk. 24
1267
0
jouluk. 23
1239
0
lokak. 21
2834