Community: Human Resources mailing list archives

expert-hr@mail.odoo.com

How to Pick the birthday from the current hr.employee? hr_paryroll salary rule

by
@ryder
- 02/11/2015 06:51:34
How can I retrieve the birthday of employee from hr to be executed on hr_payroll  - salary rule

import time
from dateutil.relativedelta import relativedelta
from datetime import datetime
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT

start = datetime.strptime("1977-01-28", DEFAULT_SERVER_DATE_FORMAT);
end = datetime.strptime(time.strftime(DEFAULT_SERVER_DATE_FORMAT), DEFAULT_SERVER_DATE_FORMAT);
delta = end - start
age = (delta.days / 365);

if age < 35:
result = 0.17 * 1000
elif age >= 35  and age < 45:
result = 0.17 * 1000
elif age >= 45  and age < 50:
result = 0.17 * 1000
elif age >= 50  and age < 55:
result = 0.16 * 1000
elif age >= 55  and age < 60:
result = 0.12 * 1000
elif age >= 55  and age < 60:
result = 0.085 * 1000
elif age > 65:
result = 0.075 * 1000