diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index 464c3d295a4..f025addc61e 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -211,6 +211,7 @@ class one2many_mod2(fields.one2many): class hr_payslip_run(osv.osv): _name = 'hr.payslip.run' + _description = 'Payslip Run' _columns = { 'name': fields.char('Name', size=64, required=True, readonly=True, states={'draft': [('readonly', False)]}), 'slip_ids': fields.one2many('hr.payslip', 'payslip_run_id', 'Payslips', required=False, readonly=True, states={'draft': [('readonly', False)]}), diff --git a/addons/hr_payroll/hr_payroll_view.xml b/addons/hr_payroll/hr_payroll_view.xml index 84b7061aeab..510fe49f75c 100644 --- a/addons/hr_payroll/hr_payroll_view.xml +++ b/addons/hr_payroll/hr_payroll_view.xml @@ -663,8 +663,8 @@ search - - + + @@ -683,6 +683,7 @@ + diff --git a/addons/hr_payroll_account/__init__.py b/addons/hr_payroll_account/__init__.py index ee7125d5411..ffe4b707ac0 100644 --- a/addons/hr_payroll_account/__init__.py +++ b/addons/hr_payroll_account/__init__.py @@ -21,5 +21,6 @@ ############################################################################## import hr_payroll_account +import wizard # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/hr_payroll_account/hr_payroll_account.py b/addons/hr_payroll_account/hr_payroll_account.py index 1ff19e01bb1..8e4e73458f2 100644 --- a/addons/hr_payroll_account/hr_payroll_account.py +++ b/addons/hr_payroll_account/hr_payroll_account.py @@ -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') @@ -174,5 +181,14 @@ class hr_contract(osv.osv): } hr_contract() +class hr_payslip_run(osv.osv): + + _inherit = 'hr.payslip.run' + _description = 'Payslip Run' + _columns = { + 'journal_id': fields.many2one('account.journal', 'Expense Journal', states={'draft': [('readonly', False)]}, readonly=True, required=True), + } + +hr_payslip_run() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_payroll_account/hr_payroll_account_view.xml b/addons/hr_payroll_account/hr_payroll_account_view.xml index 825fac9cab4..667b1308ec5 100644 --- a/addons/hr_payroll_account/hr_payroll_account_view.xml +++ b/addons/hr_payroll_account/hr_payroll_account_view.xml @@ -51,6 +51,46 @@ + + + + hr.payslip.run.search.inherit + hr.payslip.run + search + + + + + + + + + + + hr.payslip.run.tree.inherit + hr.payslip.run + tree + + + + + + + + + + hr.payslip.run.form.inherit + hr.payslip.run + form + + + + + + + + + diff --git a/addons/hr_payroll_account/wizard/__init__.py b/addons/hr_payroll_account/wizard/__init__.py new file mode 100644 index 00000000000..27128f05597 --- /dev/null +++ b/addons/hr_payroll_account/wizard/__init__.py @@ -0,0 +1,25 @@ +#-*- coding:utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). 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 . +# +############################################################################## + +import hr_payroll_payslips_by_employees + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/hr_payroll_account/wizard/hr_payroll_payslips_by_employees.py b/addons/hr_payroll_account/wizard/hr_payroll_payslips_by_employees.py new file mode 100644 index 00000000000..a00ff97ef6b --- /dev/null +++ b/addons/hr_payroll_account/wizard/hr_payroll_payslips_by_employees.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +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: \ No newline at end of file