[MERGE[ hr_payroll_account: journal_id on payslip run
bzr revid: qdp-launchpad@openerp.com-20110915162603-psjo4r9m6869v2ny
This commit is contained in:
@@ -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)]}),
|
||||
|
||||
@@ -663,8 +663,8 @@
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Payslip Runs">
|
||||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft runs"/>
|
||||
<filter icon="terp-camera_test" string="Done" domain="[('state','=','done')]" help="Done runs"/>
|
||||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Payslip Runs"/>
|
||||
<filter icon="terp-camera_test" string="Done" domain="[('state','=','close')]" help="Done Payslip Runs"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name"/>
|
||||
<field name="date_start"/>
|
||||
@@ -683,6 +683,7 @@
|
||||
<field name="date_start"/>
|
||||
<field name="date_end"/>
|
||||
<field name="credit_note"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -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')
|
||||
@@ -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:
|
||||
|
||||
@@ -51,6 +51,46 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Payslip Run View -->
|
||||
|
||||
<record id="hr_payslip_run_search_inherit" model="ir.ui.view">
|
||||
<field name="name">hr.payslip.run.search.inherit</field>
|
||||
<field name="model">hr.payslip.run</field>
|
||||
<field name="type">search</field>
|
||||
<field name="inherit_id" ref="hr_payroll.hr_payslip_run_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="date_end" position="after">
|
||||
<newline/>
|
||||
<field name="journal_id" widget="selection"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="hr_payslip_run_tree_inherit" model="ir.ui.view">
|
||||
<field name="name">hr.payslip.run.tree.inherit</field>
|
||||
<field name="model">hr.payslip.run</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="inherit_id" ref="hr_payroll.hr_payslip_run_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="date_end" position="after">
|
||||
<field name="journal_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="hr_payslip_run_form_inherit" model="ir.ui.view">
|
||||
<field name="name">hr.payslip.run.form.inherit</field>
|
||||
<field name="model">hr.payslip.run</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="hr_payroll.hr_payslip_run_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="date_end" position="after">
|
||||
<newline/>
|
||||
<field name="journal_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -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:
|
||||
Reference in New Issue
Block a user