[MERGE] fixes in payroll
bzr revid: fp@tinyerp.com-20120920091021-ieq47tyn4bffwcmo
This commit is contained in:
commit
1766a3a9e2
|
@ -669,26 +669,26 @@ class hr_payslip(osv.osv):
|
|||
if not context.get('contract', False):
|
||||
#fill with the first contract of the employee
|
||||
contract_ids = self.get_contract(cr, uid, employee_id, date_from, date_to, context=context)
|
||||
res['value'].update({
|
||||
'struct_id': contract_ids and contract_obj.read(cr, uid, contract_ids[0], ['struct_id'], context=context)['struct_id'][0] or False,
|
||||
'contract_id': contract_ids and contract_ids[0] or False,
|
||||
})
|
||||
else:
|
||||
if contract_id:
|
||||
#set the list of contract for which the input have to be filled
|
||||
contract_ids = [contract_id]
|
||||
#fill the structure with the one on the selected contract
|
||||
contract_record = contract_obj.browse(cr, uid, contract_id, context=context)
|
||||
res['value'].update({
|
||||
'struct_id': contract_record.struct_id.id,
|
||||
'contract_id': contract_id
|
||||
})
|
||||
else:
|
||||
#if we don't give the contract, then the input to fill should be for all current contracts of the employee
|
||||
contract_ids = self.get_contract(cr, uid, employee_id, date_from, date_to, context=context)
|
||||
if not contract_ids:
|
||||
return res
|
||||
|
||||
if not contract_ids:
|
||||
return res
|
||||
contract_record = contract_obj.browse(cr, uid, contract_ids[0], context=context)
|
||||
res['value'].update({
|
||||
'contract_id': contract_record and contract_record.id or False
|
||||
})
|
||||
struct_record = contract_record and contract_record.struct_id or False
|
||||
if not struct_record:
|
||||
return res
|
||||
res['value'].update({
|
||||
'struct_id': struct_record.id,
|
||||
})
|
||||
#computation of the salary input
|
||||
worked_days_line_ids = self.get_worked_day_lines(cr, uid, contract_ids, date_from, date_to, context=context)
|
||||
input_line_ids = self.get_inputs(cr, uid, contract_ids, date_from, date_to, context=context)
|
||||
|
|
|
@ -234,7 +234,7 @@
|
|||
</h2>
|
||||
</div>
|
||||
<group col="4">
|
||||
<field name="contract_id" domain="[('employee_id','=',employee_id)]" on_change="onchange_contract_id(date_from, date_to, employee_id, contract_id)"/>
|
||||
<field name="contract_id" domain="[('employee_id','=',employee_id)]" on_change="onchange_contract_id(date_from, date_to, employee_id, contract_id)" context="{'default_employee_id': employee_id}"/>
|
||||
<field name="number"/>
|
||||
<field name="struct_id" attrs="{'required':[('contract_id','<>',False)]}"/>
|
||||
<field name="name"/>
|
||||
|
|
Loading…
Reference in New Issue