Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
4753 Widoki

i created a form for termination of an employee i have the join date and end date of the employee.. what i want is how many days this employee had worked between these two dates ie: number of working days between two dates

Awatar
Odrzuć
Najlepsza odpowiedź

Hello faizan,


Hope you are doing well.


You can calculate working days using the compute method

write you code like this.


from datetime import date


    employee_join_date = fields.Datetime(string='Employee Start Date')

    employee_end_date = fields.Datetime(string='Employee End Date')

    workdays = fields.Integer(string='Employee Working Days',compute='compute_calculate_workday')


    @api.depends('employee_end_date','employee_end_date')

    def compute_calculate_workday(self):

        for rec in self:

            rec.workdays = (rec.employee_join_date - rec.employee_end_date).days


I Hope this information proves helpful to you.

Thanks & Regards,

Email:   odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari 

Awatar
Odrzuć
Najlepsza odpowiedź

hope you find out the anwser

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
maj 25
1029
1
mar 25
1207
0
lut 25
1421
1
gru 24
1865
0
lis 24
108