Odoo Help


Payslip for all employes

benmansour abdessamed
on 3/13/16, 11:42 AM 818 views


Can any one help me to create and calculate the payslip for all emlpoyes with one link. for now for do this i must to enter to the all employes (one by one),

There is a function that calaculat automatiquely the payslip ? 


Hi belal salah, 

Thanx for your answer, I did what you said, but i dont have the all payslips of employees.

Belal Salah
On 3/14/16, 4:44 AM
this need some customization by adding new button in payslip batch to call compute function (process_sheet) in model(hr.payslip) for every payslip.

this snap code may help you:

@api.v7def compute_sheet(self, cr, uid, ids, context=None):    emp_pool = self.pool.get('hr.employee')    slip_pool = self.pool.get('hr.payslip')    run_pool = self.pool.get('hr.payslip.run')    slip_ids = []    if context is None:        context = {}    data = self.read(cr, uid, ids, context=context)[0]    count = 0    run_data = {}    if context and context.get('active_id', False):        run_data = run_pool.read(cr, uid, [context['active_id']], ['date_start', 'date_end', 'credit_note'])[0]        slips_ids = slip_pool.search(cr, uid, [('payslip_run_id', '=', context['active_id'])])        if len(slips_ids) > 0:            count = len(slips_ids)    from_date = run_data.get('date_start', False)    to_date = run_data.get('date_end', False)    credit_note = run_data.get('credit_note', False)    if not data['employee_ids']:        raise ValidationError(_("You must select employee(s) to generate payslip(s)."))    for emp in emp_pool.browse(cr, uid, data['employee_ids'], context=context):        count += 1        slip_data = slip_pool.onchange_employee_id(cr, uid, [], from_date, to_date, emp.id, contract_id=False,                                                   context=context)        res = {            'seq_count': count,            'employee_id': emp.id,            'name': _('Salary Slip of %s') % (emp.name),            'struct_id': slip_data['value'].get('struct_id', False),            'contract_id': slip_data['value'].get('contract_id', False),            'payslip_run_id': context.get('active_id', False),            'input_line_ids': [(0, 0, x) for x in slip_data['value'].get('input_line_ids', False)],            'worked_days_line_ids': [(0, 0, x) for x in slip_data['value'].get('worked_days_line_ids', False)],            'date_from': from_date,            'date_to': to_date,            'credit_note': credit_note,        }        slip_ids.append(slip_pool.create(cr, uid, res, context=context))    slip_pool.compute_sheet(cr, uid, slip_ids, context=context)    return {'type': 'ir.actions.act_window_close'}

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 3/13/16, 11:42 AM
Seen: 818 times
Last updated: 3/14/16, 9:28 AM