def get_inputs(self, contract_ids, date_from, date_to):
"""This Compute the other inputs to employee payslip.
"""
res = super(SalaryRuleInput, self).get_inputs(contract_ids, date_from, date_to)
contract_obj = self.env['hr.contract']
emp_id = contract_obj.browse(contract_ids[0].id).employee_id
adv_salary = self.env['salary.advance'].search([('employee_id', '=', emp_id.id)])
for adv_obj in adv_salary:
current_date = datetime.strptime(date_from, '%Y-%m-%d').date().month
date = adv_obj.date
existing_date = datetime.strptime(date, '%Y-%m-%d').date().month
if current_date == existing_date:
state = adv_obj.state
amount = adv_obj.advance
for result in res:
if state == 'approve' and amount != 0 and result.get('code') == 'SAR':
result['amount'] = amount
return res
In this method odoo 12 gives me an error in the line
current_date = datetime.strptime(date_from, '%Y-%m-%d').date().month
It said that first argument must be a string. Can you tell me how to fix it and why it is working in version 11?
Thanks in advance
Grettings Abdullah, in this function get_inputs(self, contract_ids, date_from, date_to):
return me only one value of advance salary, but i want this return the sum of two values or more values of advance salary in the same month(was made the change to let me make more than one advance salary). Please, can you help me, wich will be the modification of the funcion code?