This question has been flagged
2 Replies
10084 Views

How to create q salary rule when worker works in holiday (1st of may,25 december) and we need to pay salary x 1.5?

WE also need to pay bonus when he worked preceding 3months with more than 75% attendance.

Can we create such rules or do we need to write method in Python ?

Avatar
Discard

<record id="extra_hr_salaire_hs" model="hr.salary.rule">
<field name="category_id" ref="hr_payroll.ALW"/>
<field name="name">heure supplémentaire</field>
<field name="code">STAR0002</field>
<field name="appears_on_payslip">True</field>
<field name="sequence">00002</field>
<field name="condition_select">none</field>
<field name="amount_select">code</field>
<field name="amount_python_compute">if worked_days.number_of_days > 30:
result = contract.wage + contract.wage * (worked_days.number_of_days-30) /100
else:
result = contract.wage </field>

Best Answer

A partire des regel salarial , chaque models possede un ligne de communication sur l'autre models
# Available variables:
#----------------------
# payslip: object containing the payslips
# employee: hr.employee object
# contract: hr.contract object
# rules: object containing the rules code (previously computed)
# categories: object containing the computed salary rule categories (sum of amount of all rules belonging to that category).
# worked_days: object containing the computed worked days.
# inputs: object containing the computed inputs.


# Note: returned value have to be set in the variable 'result'


result = contract.wage * 0.10





record go here 

Avatar
Discard

<record id="extra_hr_salaire_hs" model="hr.salary.rule">
<field name="category_id" ref="hr_payroll.ALW"/>
<field name="name">heure supplémentaire</field>
<field name="code">STAR0002</field>
<field name="appears_on_payslip">True</field>
<field name="sequence">00002</field>
<field name="condition_select">none</field>
<field name="amount_select">code</field>
<field name="amount_python_compute">if worked_days.number_of_days > 30:
result = contract.wage + contract.wage * (worked_days.number_of_days-30) /100
else:
result = contract.wage </field>

Best Answer

You need to go with a new module.

One way to do this is inherit from hr.payslip, and patch the method get_inputs so that you go over employees attendance, check if worked on holidays and his attendance records and create inputs for them.

class hr_payslip(osv.osv):
    '''
    Pay Slip
    '''
    _inherit = 'hr.payslip'

    def get_inputs(self, cr, uid, contract_ids, date_from, date_to, context=None):
        res = super(hr_payslip, self).get_inputs(cr, uid, contract_ids, date_from, date_to, context=context)
        contract_obj = self.pool.get('hr.contract')

        for contract in contract_obj.browse(cr, uid, contract_ids, context=context):

            """
               Your code here to find out if emplooyee has more than 75% attendance.
               Suppose you set a flag called 'good_attendance'
            """
            input = {
                 'name': 'Attendance over 75 percent',
                 'code': 'ATTENDANCE_OVER_75',
                 'contract_id': contract.id,
                 'amount': good_attendance,
            }
            res += [input]

        return res

Then you create a rule that checks for ATTENDANCE_OVER_75 input and adds a bonus if true...

Similar will be for checking if employee worked on holidays...

Avatar
Discard
Author

daily attendace how to entered.?seems no modules to capture employee;'s come or not.!

i got only leave management views

Check http://doc.openerp.com/v6.1/book/4/4_11_HR/4_11_HR_timesheet.html It explains time sheets and attendance management

Author

Thanks Mario