[FIX] Hr_payroll: Inherit wizard of payslip runs to pass journl id on context which used to create payslips
bzr revid: mra@tinyerp.com-20110915054539-2ihi7ls1wlxer72t
This commit is contained in:
parent
bddfe1cd5a
commit
36330b362a
|
@ -21,5 +21,6 @@
|
|||
##############################################################################
|
||||
|
||||
import hr_payroll_account
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -39,6 +39,13 @@ class hr_payslip(osv.osv):
|
|||
'journal_id': fields.many2one('account.journal', 'Expense Journal',states={'draft': [('readonly', False)]}, readonly=True, required=True),
|
||||
'move_id': fields.many2one('account.move', 'Accounting Entry', readonly=True),
|
||||
}
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if 'journal_id' in context:
|
||||
vals.update({'journal_id': context.get('journal_id')})
|
||||
return super(hr_payslip, self).create(cr, uid, vals, context=context)
|
||||
|
||||
def onchange_contract_id(self, cr, uid, ids, date_from, date_to, employee_id=False, contract_id=False, context=None):
|
||||
contract_obj = self.pool.get('hr.contract')
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#-*- coding:utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# d$
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import hr_payroll_payslips_by_employees
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,40 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv
|
||||
|
||||
class hr_payslip_employees(osv.osv_memory):
|
||||
|
||||
_inherit ='hr.payslip.employees'
|
||||
|
||||
def compute_sheet(self, cr, uid, ids, context=None):
|
||||
run_pool = self.pool.get('hr.payslip.run')
|
||||
if context is None:
|
||||
context = {}
|
||||
if context and context.get('active_id', False):
|
||||
run_data = run_pool.read(cr, uid, context['active_id'], ['journal_id'])
|
||||
journal_id = run_data.get('journal_id', False)[0]
|
||||
context.update({'journal_id': journal_id})
|
||||
return super(hr_payslip_employees, self).compute_sheet(cr, uid, ids, context=context)
|
||||
|
||||
hr_payslip_employees()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
Loading…
Reference in New Issue