Hello,
In Odoo 17 Studio
I like to do a calculation for the base field. But I am unable to write a computation code on the base field.
I have written a code in UI change the automation rule but that is also not working Can i get assistance for that?
Fields and name of the field:
x_studio_selection_field_5ir_1hhu4okhd = Rental Based (Selection field "Hourly","Daily","Weekly","Monthly")
x_studio_related_field_4io_1hhu53ucr=working Hours(integer Field)
price_unit= Unit Price(Base Field)
x_studio_duration= Duration in days (Integer Field)
price_subtotal = Total excluding tax(Base Field)
I have used the below code for calculation
result=False
for record in self:
if record.x_studio_selection_field_5ir_1hhu4okhd == "Hourly":
result=record.x_studio_related_field_4io_1hhu53ucr*record.price_unit
elif record.x_studio_selection_field_5ir_1hhu4okhd == "Daily":
result=record.x_studio_duration*record.price_unit
elif record.x_studio_selection_field_5ir_1hhu4okhd == "Weekly":
result=(record.x_studio_duration/7)*record.price_unit
else:
result=(record.x_studio_duration/30)*record.price_unit
record['price_subtotal']=result