hr_payroll

bzr revid: rmu@tinyerp.com-20111122124129-awp6gqiu2prp7egc
This commit is contained in:
RavishchanraMurari (Open ERP) 2011-11-22 18:11:29 +05:30
parent dce6cba5ce
commit fe0754a549
3 changed files with 22 additions and 1 deletions

View File

@ -297,6 +297,16 @@ class hr_payslip(osv.osv):
self.pool.get('res.users').browse(cr, uid, uid,
context=context).company_id.id,
}
def _check_dates(self, cr, uid, ids, context=None):
for i in self.read(cr, uid, ids, ['date_from', 'date_to'], context=context):
if i['date_from'] > i['date_to']:
return False
return True
_constraints = [
(_check_dates, 'Error! Payslip from-date must be lower then contract to-date.', ['date_from', 'date_to'])
]
def copy(self, cr, uid, id, default=None, context=None):
if not default:

View File

@ -6,7 +6,7 @@
auto="False"
id="payslip_report"
model="hr.payslip"
name="test.pdf"
name="Payslip"
rml="hr_payroll/report/report_payslip.rml"
string="Employee PaySlip" />

View File

@ -33,6 +33,13 @@ class hr_payslip(osv.osv):
'''
_inherit = 'hr.payslip'
_description = 'Pay Slip'
def _get_journal(self, cr, uid, context=None):
if context is None:
context = {}
journal_obj = self.pool.get('account.journal')
res = journal_obj.search(cr, uid, [('type', '=','sale')])
return res and res[0] or False
_columns = {
'period_id': fields.many2one('account.period', 'Force Period',states={'draft': [('readonly', False)]}, readonly=True, domain=[('state','<>','done')], help="Keep empty to use the period of the validation(Payslip) date."),
@ -40,6 +47,10 @@ class hr_payslip(osv.osv):
'move_id': fields.many2one('account.move', 'Accounting Entry', readonly=True),
}
_defaults = {
'journal_id': _get_journal,
}
def copy(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}