[IMP, FIX] hr_payroll: Remove Compute and Recompute buttons from hr.payslip, fixes: on hr.contract Visa fields become required=true when we fill the passport, Improve view of hr.payslip

bzr revid: psi@tinyerp.co.in-20110302093407-7vchj5e2hw70357h
This commit is contained in:
psi (Open ERP)
2011-03-02 15:04:07 +05:30
parent 250e2fc68e
commit aeb79ab194
3 changed files with 303 additions and 297 deletions
+1 -1
View File
@@ -104,7 +104,7 @@ class hr_contract(osv.osv):
'trial_date_end': fields.date('Trial End Date'),
'working_hours': fields.many2one('resource.calendar','Working Schedule'),
# 'wage_type_id': fields.many2one('hr.contract.wage.type', 'Wage Type', required=True),
'wage': fields.float('Wage', digits=(16,2), required=True),
'wage': fields.float('Wage', digits=(16,2), required=True, help="Basic Salary of the employee"),
'advantages': fields.text('Advantages'),
'advantages_net': fields.float('Net Advantages Value', digits=(16,2)),
'advantages_gross': fields.float('Gross Advantages Value', digits=(16,2)),
+291 -285
View File
@@ -402,8 +402,8 @@ class payroll_register(osv.osv):
old_slips = slip_pool.search(cr, uid, [('employee_id','=', emp.id), ('date','=',vals.date)], context=context)
if old_slips:
slip_pool.write(cr, uid, old_slips, {'register_id':ids[0]}, context=context)
for sid in old_slips:
wf_service.trg_validate(uid, 'hr.payslip', sid, 'compute_sheet', cr)
# for sid in old_slips:
# wf_service.trg_validate(uid, 'hr.payslip', sid, 'compute_sheet', cr)
else:
res = {
'employee_id':emp.id,
@@ -413,7 +413,7 @@ class payroll_register(osv.osv):
'date':vals.date,
}
slip_id = slip_pool.create(cr, uid, res, context=context)
wf_service.trg_validate(uid, 'hr.payslip', slip_id, 'compute_sheet', cr)
# wf_service.trg_validate(uid, 'hr.payslip', slip_id, 'compute_sheet', cr)
number = self.pool.get('ir.sequence').get(cr, uid, 'salary.register')
self.write(cr, uid, ids, {'state':'draft', 'number':number}, context=context)
@@ -854,11 +854,11 @@ class hr_payslip(osv.osv):
slip_line_obj.write(cr, uid, [line.id], {'total':amount}, context=context)
record = {
# 'allounce':allow,
# 'deduction':deduct,
# 'grows':rs.basic + allow,
# 'net':rs.basic + allow - deduct,
# 'other_pay':others,
'allounce':allow,
'deduction':deduct,
'grows':rs.basic + allow,
'net':rs.basic + allow - deduct,
'other_pay':others,
'state': 'draft',
'total_pay': abs(contract.wage + allow - deduct)
}
@@ -884,13 +884,13 @@ class hr_payslip(osv.osv):
'basic_before_leaves': fields.float('Basic Salary', readonly=True, digits_compute=dp.get_precision('Account')),
'leaves': fields.float('Leave Deductions', readonly=True, digits_compute=dp.get_precision('Account')),
'basic': fields.float('Net Basic', readonly=True, digits_compute=dp.get_precision('Account')),
# 'grows': fields.function(_calculate, method=True, store=True, multi='dc', string='Gross Salary', digits_compute=dp.get_precision('Account')),
# 'net': fields.function(_calculate, method=True, store=True, multi='dc', string='Net Salary', digits_compute=dp.get_precision('Account')),
# 'allounce': fields.function(_calculate, method=True, store=True, multi='dc', string='Allowance', digits_compute=dp.get_precision('Account')),
# 'deduction': fields.function(_calculate, method=True, store=True, multi='dc', string='Deduction', digits_compute=dp.get_precision('Account')),
# 'other_pay': fields.function(_calculate, method=True, store=True, multi='dc', string='Others', digits_compute=dp.get_precision('Account')),
# 'total_pay': fields.function(_calculate, method=True, store=True, multi='dc', string='Total Payment', digits_compute=dp.get_precision('Account')),
'total_pay': fields.float('Total Payment', readonly=True, digits_compute=dp.get_precision('Account')),
'grows': fields.function(_calculate, method=True, store=True, multi='dc', string='Gross Salary', digits_compute=dp.get_precision('Account')),
'net': fields.function(_calculate, method=True, store=True, multi='dc', string='Net Salary', digits_compute=dp.get_precision('Account')),
'allounce': fields.function(_calculate, method=True, store=True, multi='dc', string='Allowance', digits_compute=dp.get_precision('Account')),
'deduction': fields.function(_calculate, method=True, store=True, multi='dc', string='Deduction', digits_compute=dp.get_precision('Account')),
'other_pay': fields.function(_calculate, method=True, store=True, multi='dc', string='Others', digits_compute=dp.get_precision('Account')),
'total_pay': fields.function(_calculate, method=True, store=True, multi='dc', string='Total Payment', digits_compute=dp.get_precision('Account')),
# 'total_pay': fields.float('Total Payment', readonly=True, digits_compute=dp.get_precision('Account')),
'line_ids':fields.one2many('hr.payslip.line', 'slip_id', 'Payslip Line', required=False, readonly=True, states={'draft': [('readonly', False)]}),
'company_id':fields.many2one('res.company', 'Company', required=False, readonly=True, states={'draft': [('readonly', False)]}),
'holiday_days': fields.float('No of Leaves', readonly=True),
@@ -983,7 +983,6 @@ class hr_payslip(osv.osv):
'total':line.total + line.total
}
register_line_pool.create(cr, uid, reg_line)
self.write(cr, uid, ids, {'state':'confirm'}, context=context)
return True
@@ -1065,248 +1064,248 @@ class hr_payslip(osv.osv):
result = [x[0] for x in res]
return result
def compute_sheet(self, cr, uid, ids, context=None):
func_pool = self.pool.get('hr.payroll.structure')
slip_line_pool = self.pool.get('hr.payslip.line')
holiday_pool = self.pool.get('hr.holidays')
sequence_obj = self.pool.get('ir.sequence')
if context is None:
context = {}
date = self.read(cr, uid, ids, ['date'], context=context)[0]['date']
#Check for the Holidays
def get_days(start, end, month, year, calc_day):
import datetime
count = 0
for day in range(start, end):
if datetime.date(year, month, day).weekday() == calc_day:
count += 1
return count
for slip in self.browse(cr, uid, ids, context=context):
old_slip_ids = slip_line_pool.search(cr, uid, [('slip_id','=',slip.id)], context=context)
slip_line_pool.unlink(cr, uid, old_slip_ids, context=context)
update = {}
ttyme = datetime.fromtimestamp(time.mktime(time.strptime(slip.date,"%Y-%m-%d")))
contracts = self.get_contract(cr, uid, slip.employee_id, date, context)
if contracts.get('id', False) == False:
update.update({
'basic': round(0.0),
'basic_before_leaves': round(0.0),
'name':'Salary Slip of %s for %s' % (slip.employee_id.name, tools.ustr(ttyme.strftime('%B-%Y'))),
'state':'draft',
'contract_id':False,
'company_id':slip.employee_id.company_id.id
})
self.write(cr, uid, [slip.id], update, context=context)
continue
contract = slip.employee_id.contract_id
# sal_type = contract.wage_type_id.type
function = contract.struct_id.id
lines = []
if function:
func = func_pool.read(cr, uid, function, ['line_ids'], context=context)
lines = slip_line_pool.browse(cr, uid, func['line_ids'], context=context)
#lines += slip.employee_id.line_ids
ad = []
all_per = 0.0
ded_per = 0.0
all_fix = 0.0
ded_fix = 0.0
obj = {'basic':0.0}
# if contract.wage_type_id.type == 'gross':
# obj['gross'] = contract.wage
# update['igross'] = contract.wage
# if contract.wage_type_id.type == 'net':
# obj['net'] = contract.wage
# update['inet'] = contract.wage
# if contract.wage_type_id.type == 'basic':
# obj['basic'] = contract.wage
# update['basic'] = contract.wage
for line in lines:
cd = line.code.lower()
obj[cd] = line.amount or 0.0
for line in lines:
if line.category_id.code in ad:
continue
ad.append(line.category_id.code)
cd = line.category_id.code.lower()
calculate = False
try:
exp = line.category_id.condition
calculate = eval(exp, obj)
except Exception, e:
raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ') % (e))
if not calculate:
continue
percent = 0.0
value = 0.0
base = False
# company_contrib = 0.0
base = line.category_id.base
try:
#Please have a look at the configuration guide.
amt = eval(base, obj)
except Exception, e:
raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ') % (e))
# if sal_type in ('gross', 'net'):
# if line.amount_type == 'per':
# percent = line.amount
# if amt > 1:
# value = percent * amt
# elif amt > 0 and amt <= 1:
# percent = percent * amt
# if value > 0:
# percent = 0.0
# elif line.amount_type == 'fix':
# value = line.amount
# elif line.amount_type == 'func':
# value = slip_line_pool.execute_function(cr, uid, line.id, amt, context)
# line.amount = value
# def compute_sheet(self, cr, uid, ids, context=None):
# func_pool = self.pool.get('hr.payroll.structure')
# slip_line_pool = self.pool.get('hr.payslip.line')
# holiday_pool = self.pool.get('hr.holidays')
# sequence_obj = self.pool.get('ir.sequence')
# if context is None:
# context = {}
# date = self.read(cr, uid, ids, ['date'], context=context)[0]['date']
# #Check for the Holidays
# def get_days(start, end, month, year, calc_day):
# import datetime
# count = 0
# for day in range(start, end):
# if datetime.date(year, month, day).weekday() == calc_day:
# count += 1
# return count
#
# for slip in self.browse(cr, uid, ids, context=context):
# old_slip_ids = slip_line_pool.search(cr, uid, [('slip_id','=',slip.id)], context=context)
# slip_line_pool.unlink(cr, uid, old_slip_ids, context=context)
# update = {}
# ttyme = datetime.fromtimestamp(time.mktime(time.strptime(slip.date,"%Y-%m-%d")))
# contracts = self.get_contract(cr, uid, slip.employee_id, date, context)
# if contracts.get('id', False) == False:
# update.update({
# 'basic': round(0.0),
# 'basic_before_leaves': round(0.0),
# 'name':'Salary Slip of %s for %s' % (slip.employee_id.name, tools.ustr(ttyme.strftime('%B-%Y'))),
# 'state':'draft',
# 'contract_id':False,
# 'company_id':slip.employee_id.company_id.id
# })
# self.write(cr, uid, [slip.id], update, context=context)
# continue
#
# contract = slip.employee_id.contract_id
## sal_type = contract.wage_type_id.type
# function = contract.struct_id.id
# lines = []
# if function:
# func = func_pool.read(cr, uid, function, ['line_ids'], context=context)
# lines = slip_line_pool.browse(cr, uid, func['line_ids'], context=context)
#
# #lines += slip.employee_id.line_ids
#
# ad = []
# all_per = 0.0
# ded_per = 0.0
# all_fix = 0.0
# ded_fix = 0.0
#
# obj = {'basic':0.0}
## if contract.wage_type_id.type == 'gross':
## obj['gross'] = contract.wage
## update['igross'] = contract.wage
## if contract.wage_type_id.type == 'net':
## obj['net'] = contract.wage
## update['inet'] = contract.wage
## if contract.wage_type_id.type == 'basic':
## obj['basic'] = contract.wage
## update['basic'] = contract.wage
#
# for line in lines:
# cd = line.code.lower()
# obj[cd] = line.amount or 0.0
#
# for line in lines:
# if line.category_id.code in ad:
# continue
# ad.append(line.category_id.code)
# cd = line.category_id.code.lower()
# calculate = False
# try:
# exp = line.category_id.condition
# calculate = eval(exp, obj)
# except Exception, e:
# raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ') % (e))
#
# if not calculate:
# continue
#
# percent = 0.0
# value = 0.0
# base = False
## company_contrib = 0.0
# base = line.category_id.base
#
# try:
# #Please have a look at the configuration guide.
# amt = eval(base, obj)
# except Exception, e:
# raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ') % (e))
#
## if sal_type in ('gross', 'net'):
## if line.amount_type == 'per':
## percent = line.amount
## if amt > 1:
## value = percent * amt
## elif amt > 0 and amt <= 1:
## percent = percent * amt
## if value > 0:
## percent = 0.0
## elif line.amount_type == 'fix':
## value = line.amount
## elif line.amount_type == 'func':
## value = slip_line_pool.execute_function(cr, uid, line.id, amt, context)
## line.amount = value
## else:
# if line.amount_type in ('fix', 'per'):
# value = line.amount
# elif line.amount_type == 'func':
# value = slip_line_pool.execute_function(cr, uid, line.id, amt, context)
# line.amount = value
# if line.type == 'allowance':
# all_per += percent
# all_fix += value
# elif line.type == 'deduction':
# ded_per += percent
# ded_fix += value
# vals = {
# 'amount':line.amount,
# 'slip_id':slip.id,
# 'employee_id':False,
# 'function_id':False,
# 'base':base
# }
# slip_line_pool.copy(cr, uid, line.id, vals, {})
## if sal_type in ('gross', 'net'):
## sal = contract.wage
## if sal_type == 'net':
## sal += ded_fix
## sal -= all_fix
## per = 0.0
## if sal_type == 'net':
## per = (all_per - ded_per)
## else:
## per = all_per
## if per <=0:
## per *= -1
## final = (per * 100) + 100
## basic = (sal * 100) / final
## else:
# basic = contract.wage
#
# number = sequence_obj.get(cr, uid, 'salary.slip')
# update.update({
# 'deg_id':function,
# 'number':number,
# 'basic': round(basic),
# 'basic_before_leaves': round(basic),
# 'name':'Salary Slip of %s for %s' % (slip.employee_id.name, tools.ustr(ttyme.strftime('%B-%Y'))),
# 'state':'draft',
# 'contract_id':contract.id,
# 'company_id':slip.employee_id.company_id.id
# })
#
# for line in slip.employee_id.line_ids:
# vals = {
# 'amount':line.amount,
# 'slip_id':slip.id,
# 'employee_id':False,
# 'function_id':False,
# 'base':base
# }
# slip_line_pool.copy(cr, uid, line.id, vals, {})
#
# self.write(cr, uid, [slip.id], update, context=context)
#
# for slip in self.browse(cr, uid, ids, context=context):
# if not slip.contract_id:
# continue
#
# basic_before_leaves = slip.basic
# working_day = 0
# off_days = 0
# dates = prev_bounds(slip.date)
#
# days_arr = [0, 1, 2, 3, 4, 5, 6]
# for dy in range(slip.employee_id.contract_id.working_days_per_week, 7):
# off_days += get_days(1, dates[1].day, dates[1].month, dates[1].year, days_arr[dy])
# total_off = off_days
# working_day = dates[1].day - total_off
# perday = slip.basic / working_day
# total = 0.0
# leave = 0.0
# leave_ids = self._get_leaves(cr, uid, slip, slip.employee_id, context)
# total_leave = 0.0
# paid_leave = 0.0
# h_ids = holiday_pool.browse(cr, uid, leave_ids, context=context)
# for hday in holiday_pool.browse(cr, uid, leave_ids, context=context):
# if not hday.holiday_status_id.head_id:
# raise osv.except_osv(_('Error !'), _('Please check configuration of %s, payroll head is missing') % (hday.holiday_status_id.name))
#
# res = {
# 'slip_id':slip.id,
# 'name':hday.holiday_status_id.name + '-%s' % (hday.number_of_days),
# 'code':hday.holiday_status_id.code,
# 'amount_type':'fix',
# 'category_id':hday.holiday_status_id.head_id.id,
# 'sequence':hday.holiday_status_id.head_id.sequence
# }
# days = hday.number_of_days
# if hday.number_of_days < 0:
# days = hday.number_of_days * -1
# total_leave += days
# if hday.holiday_status_id.type == 'paid':
# paid_leave += days
# continue
## res['name'] = hday.holiday_status_id.name + '-%s' % (days)
## res['amount'] = perday * days
## res['type'] = 'allowance'
## leave += days
## total += perday * days
#
# elif hday.holiday_status_id.type == 'halfpaid':
# paid_leave += (days / 2)
# res['name'] = hday.holiday_status_id.name + '-%s/2' % (days)
# res['amount'] = perday * (days/2)
# total += perday * (days/2)
# leave += days / 2
# res['type'] = 'deduction'
# else:
if line.amount_type in ('fix', 'per'):
value = line.amount
elif line.amount_type == 'func':
value = slip_line_pool.execute_function(cr, uid, line.id, amt, context)
line.amount = value
if line.type == 'allowance':
all_per += percent
all_fix += value
elif line.type == 'deduction':
ded_per += percent
ded_fix += value
vals = {
'amount':line.amount,
'slip_id':slip.id,
'employee_id':False,
'function_id':False,
'base':base
}
slip_line_pool.copy(cr, uid, line.id, vals, {})
# if sal_type in ('gross', 'net'):
# sal = contract.wage
# if sal_type == 'net':
# sal += ded_fix
# sal -= all_fix
# per = 0.0
# if sal_type == 'net':
# per = (all_per - ded_per)
# else:
# per = all_per
# if per <=0:
# per *= -1
# final = (per * 100) + 100
# basic = (sal * 100) / final
# else:
basic = contract.wage
number = sequence_obj.get(cr, uid, 'salary.slip')
update.update({
'deg_id':function,
'number':number,
'basic': round(basic),
'basic_before_leaves': round(basic),
'name':'Salary Slip of %s for %s' % (slip.employee_id.name, tools.ustr(ttyme.strftime('%B-%Y'))),
'state':'draft',
'contract_id':contract.id,
'company_id':slip.employee_id.company_id.id
})
for line in slip.employee_id.line_ids:
vals = {
'amount':line.amount,
'slip_id':slip.id,
'employee_id':False,
'function_id':False,
'base':base
}
slip_line_pool.copy(cr, uid, line.id, vals, {})
self.write(cr, uid, [slip.id], update, context=context)
for slip in self.browse(cr, uid, ids, context=context):
if not slip.contract_id:
continue
basic_before_leaves = slip.basic
working_day = 0
off_days = 0
dates = prev_bounds(slip.date)
days_arr = [0, 1, 2, 3, 4, 5, 6]
for dy in range(slip.employee_id.contract_id.working_days_per_week, 7):
off_days += get_days(1, dates[1].day, dates[1].month, dates[1].year, days_arr[dy])
total_off = off_days
working_day = dates[1].day - total_off
perday = slip.basic / working_day
total = 0.0
leave = 0.0
leave_ids = self._get_leaves(cr, uid, slip, slip.employee_id, context)
total_leave = 0.0
paid_leave = 0.0
h_ids = holiday_pool.browse(cr, uid, leave_ids, context=context)
for hday in holiday_pool.browse(cr, uid, leave_ids, context=context):
if not hday.holiday_status_id.head_id:
raise osv.except_osv(_('Error !'), _('Please check configuration of %s, payroll head is missing') % (hday.holiday_status_id.name))
res = {
'slip_id':slip.id,
'name':hday.holiday_status_id.name + '-%s' % (hday.number_of_days),
'code':hday.holiday_status_id.code,
'amount_type':'fix',
'category_id':hday.holiday_status_id.head_id.id,
'sequence':hday.holiday_status_id.head_id.sequence
}
days = hday.number_of_days
if hday.number_of_days < 0:
days = hday.number_of_days * -1
total_leave += days
if hday.holiday_status_id.type == 'paid':
paid_leave += days
continue
# res['name'] = hday.holiday_status_id.name + '-%s' % (days)
# res['amount'] = perday * days
# res['type'] = 'allowance'
# res['type'] = 'deduction'
# leave += days
# total += perday * days
elif hday.holiday_status_id.type == 'halfpaid':
paid_leave += (days / 2)
res['name'] = hday.holiday_status_id.name + '-%s/2' % (days)
res['amount'] = perday * (days/2)
total += perday * (days/2)
leave += days / 2
res['type'] = 'deduction'
else:
res['name'] = hday.holiday_status_id.name + '-%s' % (days)
res['amount'] = perday * days
res['type'] = 'deduction'
leave += days
total += perday * days
slip_line_pool.create(cr, uid, res, context=context)
holiday_pool.write(cr, uid, leave_ids, {'payslip_id': slip.id}, context=context)
basic = basic - total
# leaves = total
update.update({
'basic':basic,
'basic_before_leaves': round(basic_before_leaves),
'leaves':total,
'holiday_days':leave,
'worked_days':working_day - leave,
'working_days':working_day,
})
self.write(cr, uid, [slip.id], update, context=context)
return True
#
# slip_line_pool.create(cr, uid, res, context=context)
# holiday_pool.write(cr, uid, leave_ids, {'payslip_id': slip.id}, context=context)
# basic = basic - total
## leaves = total
# update.update({
# 'basic':basic,
# 'basic_before_leaves': round(basic_before_leaves),
# 'leaves':total,
# 'holiday_days':leave,
# 'worked_days':working_day - leave,
# 'working_days':working_day,
# })
# self.write(cr, uid, [slip.id], update, context=context)
# return True
def onchange_employee_id(self, cr, uid, ids, ddate, employee_id, context=None):
func_pool = self.pool.get('hr.payroll.structure')
@@ -1314,6 +1313,7 @@ class hr_payslip(osv.osv):
holiday_pool = self.pool.get('hr.holidays')
sequence_obj = self.pool.get('ir.sequence')
empolyee_obj = self.pool.get('hr.employee')
hr_all_ded_cate = self.pool.get('hr.allounce.deduction.categoty')
if context is None:
context = {}
@@ -1352,6 +1352,7 @@ class hr_payslip(osv.osv):
'contract_id':False,
'company_id':employee_id.company_id.id
})
return update
contract = employee_id.contract_id
# sal_type = contract.wage_type_id.type
@@ -1526,45 +1527,50 @@ class hr_payslip(osv.osv):
paid_leave = 0.0
h_ids = holiday_pool.browse(cr, uid, leave_ids, context=context)
for hday in holiday_pool.browse(cr, uid, leave_ids, context=context):
if not hday.holiday_status_id.head_id:
if not hday.holiday_status_id.code:
raise osv.except_osv(_('Error !'), _('Please check configuration of %s, payroll head is missing') % (hday.holiday_status_id.name))
slip_lines = hr_all_ded_cate.search(cr, uid, [('code','=',hday.holiday_status_id.code)], context=context)
head_sequence = 0
if slip_lines:
head_sequence = hr_all_ded_cate.read(cr, uid, slip_lines, ['sequence'], context=context)[0]['sequence']
res = {
'slip_id':hday.id,
'name':hday.holiday_status_id.name + '-%s' % (hday.number_of_days),
'code':hday.holiday_status_id.code,
'amount_type':'fix',
'category_id':hday.holiday_status_id.head_id.id,
'sequence':hday.holiday_status_id.head_id.sequence
'slip_id': hday.id,
'name': hday.holiday_status_id.name + '-%s' % (hday.number_of_days),
'code': hday.holiday_status_id.code,
'amount_type': 'fix',
'category_id': slip_lines and slip_lines[0],
'sequence': head_sequence
# 'category_id': hday.holiday_status_id.head_id.id,
# 'sequence': hday.holiday_status_id.head_id.sequence
}
days = hday.number_of_days
if hday.number_of_days < 0:
days = hday.number_of_days * -1
total_leave += days
if hday.holiday_status_id.type == 'paid':
paid_leave += days
continue
# res['name'] = hday.holiday_status_id.name + '-%s' % (days)
# res['amount'] = perday * days
# res['type'] = 'allowance'
# leave += days
# total += perday * days
elif hday.holiday_status_id.type == 'halfpaid':
paid_leave += (days / 2)
res['name'] = hday.holiday_status_id.name + '-%s/2' % (days)
res['amount'] = perday * (days/2)
total += perday * (days/2)
res['total'] = total
leave += days / 2
res['type'] = 'deduction'
else:
res['name'] = hday.holiday_status_id.name + '-%s' % (days)
res['amount'] = perday * days
res['type'] = 'deduction'
leave += days
total += perday * days
res['total'] = total
# if hday.holiday_status_id.type == 'paid':
# paid_leave += days
# continue
## res['name'] = hday.holiday_status_id.name + '-%s' % (days)
## res['amount'] = perday * days
## res['type'] = 'allowance'
## leave += days
## total += perday * days
#
# elif hday.holiday_status_id.type == 'halfpaid':
# paid_leave += (days / 2)
# res['name'] = hday.holiday_status_id.name + '-%s/2' % (days)
# res['amount'] = perday * (days/2)
# total += perday * (days/2)
# res['total'] = total
# leave += days / 2
# res['type'] = 'deduction'
# else:
res['name'] = hday.holiday_status_id.name + '-%s' % (days)
res['amount'] = perday * days
res['type'] = 'deduction'
leave += days
total += perday * days
res['total'] = total
# slip_line_pool.create(cr, uid, res, context=context)
update['value']['line_ids'].append(res)
# holiday_pool.write(cr, uid, leave_ids, {'payslip_id': ids and ids[0] or False}, context=context)
+11 -11
View File
@@ -167,9 +167,9 @@
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Valid for"/>
<field name="visa_no" attrs="{'required': [('passport_id','!=',False), ]}"/>
<field name="permit_no" attrs="{'required': [('passport_id','!=',False), ]}"/>
<field name="visa_expire" attrs="{'required': [('passport_id','!=',False), ]}"/>
<field name="visa_no"/>
<field name="permit_no"/>
<field name="visa_expire"/>
</group>
</page>
</notebook>
@@ -440,17 +440,17 @@
</field>
<group col="6" colspan="4">
<separator string="Computation Overview" colspan="6"/>
<field name="working_days"/>
<!--<field name="working_days"/>
<field name="holiday_days"/>
<field name="worked_days"/>
<field name="basic_before_leaves"/>
<field name="leaves"/>
<field name="basic"/>
<!--field name="allounce"/-->
<!--field name="deduction"/-->
<!--field name="other_pay"/-->
<!--field name="grows"/-->
<!--field name="net"/-->
<field name="allounce"/>
<field name="deduction"/>
<field name="other_pay"/>
<field name="grows"/>
<field name="net"/>-->
<field name="total_pay"/>
</group>
</page>
@@ -474,8 +474,8 @@
<group col="10" colspan="4">
<field name="state"/>
<button string="Cancel" icon="terp-dialog-close" name="cancel_sheet" states="draft,hr_check,confirm"/>
<button string="Compute Sheet" icon="terp-stock_format-scientific" name="compute_sheet" states="new"/>
<button string="Recompute Sheet" icon="terp-stock_format-scientific" name="compute_sheet" type="object" states="draft"/>
<!-- <button string="Compute Sheet" icon="terp-stock_format-scientific" name="compute_sheet" states="new"/>
<button string="Recompute Sheet" icon="terp-stock_format-scientific" name="compute_sheet" type="object" states="draft"/> -->
<button string="Verify Sheet" icon="terp-camera_test" name="verify_sheet" states="draft"/>
<button string="Approve Sheet" icon="terp-camera_test" name="final_verify_sheet" states="hr_check"/>
<button string="Pay Salary" icon="terp-dolar_ok!" name="process_sheet" states="confirm"/>