diff --git a/addons/hr_contract/hr_contract_view.xml b/addons/hr_contract/hr_contract_view.xml index 17ad8e0b0b4..205a8842748 100644 --- a/addons/hr_contract/hr_contract_view.xml +++ b/addons/hr_contract/hr_contract_view.xml @@ -355,6 +355,7 @@ + line.condition_range_max)): + value = value + else: + value = line.amount * amt + else: + value = line.amount * amt except Exception, e: raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ') % (e)) + elif line.amount_type == 'fix': - value = line.amount + if line.condition_range_min or line.condition_range_max: + if ((line.amount < line.condition_range_min) or (line.amount > line.condition_range_max)): + value = value + else: + value = line.amount + else: + value = line.amount # elif line.amount_type == 'code': # Need some clarification so this option remains # value = slip_line_pool.execute_function(cr, uid, line.id, amt, context) # line.amount = value @@ -952,7 +985,12 @@ class hr_payslip(osv.osv): 'base': line.computational_expression } if line.appears_on_payslip: - update['value']['line_ids'].append(vals) + if line.condition_range_min or line.condition_range_max: + if not((line.amount < line.condition_range_min) or (line.amount > line.condition_range_max)): + update['value']['line_ids'].append(vals) + else: + update['value']['line_ids'].append(vals) + basic = contract.wage number = sequence_obj.get(cr, uid, 'salary.slip') update['value'].update({ @@ -984,6 +1022,7 @@ class hr_payslip(osv.osv): basic_before_leaves = update['value']['basic_amount'] total_before_leaves = update['value']['total_pay'] + working_day = 0 off_days = 0 dates = prev_bounds(ddate) @@ -1008,15 +1047,17 @@ class hr_payslip(osv.osv): leave_ids = self._get_leaves1(cr, uid, ddate, employee_id, context) total_leave = 0.0 paid_leave = 0.0 + for hday in holiday_pool.browse(cr, uid, leave_ids, context=context): - if not hday.holiday_status_id.code: - raise osv.except_osv(_('Error !'), _('Please check configuration of %s, code is missing') % (hday.holiday_status_id.name)) - slip_lines = salary_rule_pool.search(cr, uid, [('code', '=', hday.holiday_status_id.code)], context=context) +# if not hday.holiday_status_id.code: +# raise osv.except_osv(_('Error !'), _('Please check configuration of %s, code is missing') % (hday.holiday_status_id.name)) + slip_lines = salary_rule_pool.search(cr, uid, [('code','=',hday.holiday_status_id.code)], context=context) head_sequence = 0 if not slip_lines: raise osv.except_osv(_('Error !'), _('Please check configuration of %s, Salary rule is missing') % (hday.holiday_status_id.name)) salary_rule = salary_rule_pool.browse(cr, uid, slip_lines, context=context)[0] base = salary_rule.computational_expression + res = { 'name': salary_rule.name + '-%s' % (hday.number_of_days), 'code': salary_rule.code, @@ -1042,7 +1083,6 @@ class hr_payslip(osv.osv): if hday.number_of_days < 0: days = hday.number_of_days * -1 total_leave += days - try: #Please have a look at the configuration guide. amt = eval(base, obj) @@ -1063,6 +1103,7 @@ class hr_payslip(osv.osv): update['value']['line_ids'].append(res) # update['value']['holiday_ids'].append(test) basic = basic + total + # leaves = total # temp_dic = holiday_pool.read(cr, uid, leave_ids, [], context=context) update['value'].update({