[6.1/7.0/trunk] hr_payroll_account doesn't update all slips in method process_sheet

Bug #1237601 reported by Aristóbulo Meneses
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Confirmed
Medium
OpenERP R&D Addons Team 3

Bug Description

In method process_sheet after creating all account.moves when super(hr_payslip, self).process_sheet(...) is invoked [slid.id] is sent instead of ids, by doing this only the last record of hr.payslip objects is updated and set to {'paid': True, 'state': 'done'}.

So, if you are working with a list of hr.payslip only the last one is going to be done, and the rest will be stuck at state: 'draft'.

This is an error.

You can check it in:

[trunk] http://bazaar.launchpad.net/~openerp/openobject-addons/trunk/view/head:/hr_payroll_account/hr_payroll_account.py#L188
[7.0] http://bazaar.launchpad.net/~openerp/openobject-addons/7.0/view/head:/hr_payroll_account/hr_payroll_account.py#L190
[6.1] http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/view/head:/hr_payroll_account/hr_payroll_account.py#L188

Tags: hr payroll
Revision history for this message
Aristóbulo Meneses (aristobulo) wrote :
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Aristobulo,

I think the code is correct because process_sheet method is a workflow method it will be called when you compute the slip.
There are a two way to generate the payslip and compute it. You can use the employee payslip menu and create payslip then compute it. Here you can only compute the sheet only for one record which is the selected payslip and its pass as a slip.id which is correct, Also we dnt have a facility to compute the multiple payslip together from this menu.

2nd option which is payslip batches. Which has generate payslip button it will create the payslip and compute it. I have tried with the multiple payslip there and its also working fine.

Would you please provide the use-case where you have faced the problem?

Thanks and waiting for your reply!

Amit Parik (amit-parik)
Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Aristóbulo Meneses (aristobulo) wrote :

Hi Amit,

process_sheet method is not about to compute and create slips, is about closing the slip and setting state to paid. So, even if you use batch slip process to create and compute slips, you will have to set each individual slip to paid. That process isn't automatic and you have to go, slip by slip and click 'Confirm' button.

Then, in that case, if i need to process (not compute) a group of slips and what do i do? i use hr_payslip process_sheet method passing a list of ids that I need to set paid=True and state='Done' and that's when hr_payroll_account comes into play.

In this method http://bazaar.launchpad.net/~openerp/openobject-addons/trunk/view/head:/hr_payroll_account/hr_payroll_account.py#L86 hr_payroll_account does create accoun_moves for each payslip that is being processed (please take notice of self.browse(cr, uid, ids, context=context)). Passing ids parameter to browse method confirms that in this case, multiple slips are being used and based on that premise multiple account.move will be created if a list of hr.payslip ids are passed in ids parameter. (Again this is not about computing slips, is about get those slips paid) and the bug is present in return when only the last payslip id is sent to super(...).process_sheet(...) to set its state=Done.

So you can replicate this bug by
1. Create a new database
2. Install hr_payroll_account
3. go to HR > Payslip batches
4. Create a new payslip batch
5. Add a couple of employees and generate payslips.
6. Then hit 'Close button' (you will have N slips as N employees you have selected)
7. Go to HR > Employee Slips and search for batch generated slips, all those slips are still in Draft (so you need to confirm one-by-one, in that case will work as you are working on individuals slips)

If you need to "batch confirm" those slips you need to call process_sheet() method with ids as the list of slips.id you have selected (wizard in payslips or button in Payslip batches you decide), then if you go this way:

i. Go to Account > Journal Entries, you will find new account.moves for each slip processed.
ii. Go to HR > Employee Slips, you will find that only the last slip of selected slips will be in state=Done and the rest (N-1) that you selected are still in draft state.

This is why, passing [slip.id] in hr_payroll_account:hr_payroll_account.py:190 and forcing to update state only for the last slip processed is a bug.

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Aristobulo,

Thanks for the detailed explanation!

I have faced the same problem at my end. Let me confirm this issue!

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Low
status: Incomplete → Confirmed
Amit Parik (amit-parik)
Changed in openobject-addons:
importance: Low → Medium
tags: removed: batch payslip
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.