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 6eb0a6d1859..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') 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