Skip to Content
Menu
This question has been flagged
1 Reply
8139 Views

1- how to use if condition in computed filed to return two values depended in other filed 

2- where can i learn to use python code in odoo 

Avatar
Discard

Please read the developer documentation first: https://www.odoo.com/documentation/11.0/ and then ask specific questions by providing the necessary information.

I want to till you something

I'm not developer and I am not interest to be

I use odoo online with odoo studio

I just need to add if equation to field Over Time in my employee attendance module

If worked_hours > 10

Over_time = ((worked_hours)-8 )*2

Elif

Over time = ((worked_hors)-9))*3

I know to use it in pythin but don't know how to applied it in odoo

Thank you

 

 

 

rom: Ermin Trevisan [mailto:trevi@twanda.com]
Sent: Sunday, August 4, 2019 2:58 PM
To: ossama.saeed@hotmail.com
Subject: Re: if condition

 

Please read the developer documentation first: https://www.odoo.com/documentation/11.0/ and then ask specific questions by providing the necessary information.

Sent by Odoo S.A. using Odoo.

Best Answer

Hello Ossama,

Please find below link it may help,

https://odoo-development.readthedocs.io/en/latest/dev/py/index.html

https://learnopenerp.blogspot.com/2018/01/python-conditional-statement.html

As an example, you may use the same method to implement it. I hope it is useful to you.

type_name = fields.Char('Type Name', compute='_compute_type_name')

@api.depends('state')
def _compute_type_name(self):
for record in self:
record.type_name = ('Quotation') if record.state in ('draft', 'sent', 'cancel') else ('Sales Order')

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Discard