← Back to team overview

openerp-india team mailing list archive

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

 

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.

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1237601

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

Status in OpenERP Addons (modules):
  Incomplete

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1237601/+subscriptions


References