From 971a91390a9467423b1edd5cc9182ccf4f03978e Mon Sep 17 00:00:00 2001 From: mtr Date: Mon, 7 Mar 2011 12:48:29 +0530 Subject: [PATCH 01/10] [IMP] hr_payroll:improvements in salary rules,salary head,salary structure and demo data bzr revid: mtr@mtr-20110307071829-rluk1idcxjtbw43u --- addons/hr_payroll/hr_payroll.py | 12 +++++----- addons/hr_payroll/hr_payroll_data.xml | 32 +++++++++++++-------------- addons/hr_payroll/hr_payroll_demo.xml | 11 +++++---- addons/hr_payroll/hr_payroll_view.xml | 20 +++++++++-------- 4 files changed, 40 insertions(+), 35 deletions(-) diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index 1f1689b531a..ccac759a04f 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -58,9 +58,9 @@ class hr_payroll_structure(osv.osv): 'name':fields.char('Name', size=256, required=True, readonly=False), 'code':fields.char('Code', size=64, required=True, readonly=False), # 'line_ids':fields.one2many('hr.payslip.line', 'function_id', 'Salary Structure', required=False), - 'company_id':fields.many2one('res.company', 'Company', required=False), + 'company_id':fields.many2one('res.company', 'Company', required=True), 'note': fields.text('Description'), - 'parent_id':fields.many2one('hr.payroll.structure', 'Parent Structure'), + 'parent_id':fields.many2one('hr.payroll.structure', 'Parent'), } _defaults = { 'company_id': lambda self, cr, uid, context: \ @@ -336,8 +336,8 @@ class hr_salary_head(osv.osv): _name = 'hr.salary.head' _description = 'Salary Head' _columns = { - 'name':fields.char('Salary Head', size=64, required=True, readonly=False), - 'code':fields.char('Salary Head Code', size=64, required=True, readonly=False), + 'name':fields.char('Name', size=64, required=True, readonly=False), + 'code':fields.char('Code', size=64, required=True, readonly=False), 'type':fields.many2one('hr.salary.head.type', 'Type', required=True, help="It is used only for the reporting purpose."), 'note': fields.text('Description'), 'user_id':fields.char('User', size=64, required=False, readonly=False), @@ -1186,7 +1186,7 @@ class hr_payslip_line(osv.osv): if category_id: category = self.pool.get('hr.salary.head').browse(cr, uid, category_id) res.update({ - 'sequence':category.sequence, +# 'sequence':category.sequence, 'name':category.name, 'code':category.code, 'type':category.type.id @@ -1208,7 +1208,7 @@ class hr_payslip_line(osv.osv): 'base':fields.char('Formula', size=1024, required=False, readonly=False), 'code':fields.char('Code', size=64, required=False, readonly=False), 'category_id':fields.many2one('hr.salary.head', 'Category', required=True), - 'type':fields.many2one('hr.salary.head.type', 'Type', required=True), + 'type':fields.many2one('hr.salary.head.type', 'Type', required=True, help="Used for the reporting purpose."), 'amount_type':fields.selection([ ('per','Percentage (%)'), ('fix','Fixed Amount'), diff --git a/addons/hr_payroll/hr_payroll_data.xml b/addons/hr_payroll/hr_payroll_data.xml index 4129b6b92e6..67811d4cc21 100644 --- a/addons/hr_payroll/hr_payroll_data.xml +++ b/addons/hr_payroll/hr_payroll_data.xml @@ -16,112 +16,112 @@ HRA House Rent Allowance - + CA Conveyance Allowance - + MA Medical Allowance - + TELA Telephone Allowance - + LTA Leave Travel Allowance - + NA Newspaper Allowance - + TA Traveling Allowance - + FA Food Allowance - + DA Dearness Allowance - + PF Provident Fund - + PT Professional Tax - + WF Welfare - + TDS Tax Deduct at Source - + LWP Leave without pay - + FC Food Coupons - + ESI Employee's State Insurance - + House Rent Allowance + @@ -24,6 +25,7 @@ Conveyance Allowance + @@ -35,6 +37,7 @@ Professional Tax + @@ -46,6 +49,7 @@ Provident Fund + @@ -68,8 +72,7 @@ - + - @@ -397,6 +398,7 @@ id="menu_hr_salary_head" action="action_hr_salary_head" parent="payroll_configure" + sequence="11" /> @@ -537,6 +539,7 @@ id="menu_action_hr_contibution_register_form" action="action_contibution_register_form" parent="payroll_configure" + sequence="14" /> hr.contibution.register.line.form @@ -594,7 +597,7 @@ - + @@ -603,11 +606,10 @@ + + - - - @@ -643,7 +645,7 @@ - + @@ -677,7 +679,7 @@ - + From 11c72fb9882807b5bde4da347f9044f1586cc158 Mon Sep 17 00:00:00 2001 From: mtr Date: Mon, 7 Mar 2011 14:15:15 +0530 Subject: [PATCH 02/10] [IMP] hr_payroll:removed 'advantages_net' and 'advantages_gross' fields from hr.contract bzr revid: mtr@mtr-20110307084515-3o33wpeh1uh3czhe --- addons/hr_contract/hr_contract.py | 2 -- addons/hr_contract/hr_contract_view.xml | 2 -- addons/hr_payroll/hr_payroll_view.xml | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/addons/hr_contract/hr_contract.py b/addons/hr_contract/hr_contract.py index bca3e62d0aa..2eb9c303fdc 100644 --- a/addons/hr_contract/hr_contract.py +++ b/addons/hr_contract/hr_contract.py @@ -117,8 +117,6 @@ class hr_contract(osv.osv): 'working_hours': fields.many2one('resource.calendar','Working Schedule'), '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)), 'notes': fields.text('Notes'), 'permit_no': fields.char('Work Permit No', size=256, required=False, readonly=False), 'passport_id': fields.many2one('hr.passport', 'Passport No', required=False), diff --git a/addons/hr_contract/hr_contract_view.xml b/addons/hr_contract/hr_contract_view.xml index 040fa670857..3231871d2f1 100644 --- a/addons/hr_contract/hr_contract_view.xml +++ b/addons/hr_contract/hr_contract_view.xml @@ -180,8 +180,6 @@ - - diff --git a/addons/hr_payroll/hr_payroll_view.xml b/addons/hr_payroll/hr_payroll_view.xml index eb1f155d4e5..eb04ae3e721 100644 --- a/addons/hr_payroll/hr_payroll_view.xml +++ b/addons/hr_payroll/hr_payroll_view.xml @@ -48,7 +48,7 @@ - + From e85b5701ee88a1bec9435e0709e5e615b672bd63 Mon Sep 17 00:00:00 2001 From: mtr Date: Mon, 7 Mar 2011 15:17:10 +0530 Subject: [PATCH 03/10] [IMP] hr_payroll:added default company_id on salary rules bzr revid: mtr@mtr-20110307094710-px4r3q1ik57h536k --- addons/hr_payroll/hr_payroll.py | 3 +++ addons/hr_payroll/hr_payroll_view.xml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index ccac759a04f..cd48b8db5bc 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -1261,6 +1261,9 @@ class hr_salary_rule(osv.osv): 'sequence': 5, 'appears_on_payslip': True, 'active': True, + 'company_id': lambda self, cr, uid, context: \ + self.pool.get('res.users').browse(cr, uid, uid, + context=context).company_id.id, } hr_salary_rule() diff --git a/addons/hr_payroll/hr_payroll_view.xml b/addons/hr_payroll/hr_payroll_view.xml index eb04ae3e721..e33860902f6 100644 --- a/addons/hr_payroll/hr_payroll_view.xml +++ b/addons/hr_payroll/hr_payroll_view.xml @@ -597,7 +597,7 @@ - + From ad9f23f99ff21f572674772c91dd866c644fa3f3 Mon Sep 17 00:00:00 2001 From: mtr Date: Mon, 7 Mar 2011 16:15:13 +0530 Subject: [PATCH 04/10] [IMP] hr_payroll:added field 'python_code' and improved view of Salary Rules bzr revid: mtr@mtr-20110307104513-mjcjedxtozza6wdf --- addons/hr_payroll/hr_payroll.py | 1 + addons/hr_payroll/hr_payroll_view.xml | 54 +++++++++++++++------------ 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index cd48b8db5bc..4caaf0e4854 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -1254,6 +1254,7 @@ class hr_salary_rule(osv.osv): 'conditions':fields.char('Condition', size=1024, required=True, readonly=False, help='Applied this head for calculation if condition is true'), 'sequence': fields.integer('Sequence', required=True, help='Use to arrange calculation sequence'), 'active':fields.boolean('Active', required=False), + 'python_code': fields.text('Python code'), } _defaults = { 'conditions': 'True', diff --git a/addons/hr_payroll/hr_payroll_view.xml b/addons/hr_payroll/hr_payroll_view.xml index e33860902f6..dab11515d2e 100644 --- a/addons/hr_payroll/hr_payroll_view.xml +++ b/addons/hr_payroll/hr_payroll_view.xml @@ -600,31 +600,37 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + From 6e6b21a87585a932d9641e0c19f977b8d2d995be Mon Sep 17 00:00:00 2001 From: mtr Date: Mon, 7 Mar 2011 16:58:17 +0530 Subject: [PATCH 05/10] [IMP] hr_payroll,hr_contract:commented 'hr.contract.wage.type' and improved strings of menuitem in payroll. bzr revid: mtr@mtr-20110307112817-f3c7o3fro4oxzejn --- addons/hr_contract/hr_contract.py | 24 +++++++++---------- addons/hr_contract/hr_contract_data.xml | 4 ++-- addons/hr_contract/hr_contract_view.xml | 6 ++--- .../hr_contract/security/ir.model.access.csv | 1 - addons/hr_payroll/__openerp__.py | 6 ++--- addons/hr_payroll/hr_payroll_data.xml | 4 ++-- addons/hr_payroll/hr_payroll_view.xml | 10 ++++---- 7 files changed, 27 insertions(+), 28 deletions(-) diff --git a/addons/hr_contract/hr_contract.py b/addons/hr_contract/hr_contract.py index 2eb9c303fdc..5ef546734bb 100644 --- a/addons/hr_contract/hr_contract.py +++ b/addons/hr_contract/hr_contract.py @@ -79,18 +79,18 @@ class hr_contract_wage_type_period(osv.osv): hr_contract_wage_type_period() #Contract wage type (hourly, daily, monthly, ...) -class hr_contract_wage_type(osv.osv): - _name = 'hr.contract.wage.type' - _description = 'Wage Type' - _columns = { - 'name': fields.char('Wage Type Name', size=50, required=True, select=True), - 'period_id': fields.many2one('hr.contract.wage.type.period', 'Wage Period', required=True), - 'factor_type': fields.float('Factor for hour cost', digits=(12,4), required=True, help='This field is used by the timesheet system to compute the price of an hour of work based on the contract of the employee') - } - _defaults = { - 'factor_type': 1.8 - } -hr_contract_wage_type() +#class hr_contract_wage_type(osv.osv): +# _name = 'hr.contract.wage.type' +# _description = 'Wage Type' +# _columns = { +# 'name': fields.char('Wage Type Name', size=50, required=True, select=True), +# 'period_id': fields.many2one('hr.contract.wage.type.period', 'Wage Period', required=True), +# 'factor_type': fields.float('Factor for hour cost', digits=(12,4), required=True, help='This field is used by the timesheet system to compute the price of an hour of work based on the contract of the employee') +# } +# _defaults = { +# 'factor_type': 1.8 +# } +#hr_contract_wage_type() class hr_contract_type(osv.osv): diff --git a/addons/hr_contract/hr_contract_data.xml b/addons/hr_contract/hr_contract_data.xml index 6e7aca57d67..50a340997ce 100644 --- a/addons/hr_contract/hr_contract_data.xml +++ b/addons/hr_contract/hr_contract_data.xml @@ -14,7 +14,7 @@ - + diff --git a/addons/hr_contract/hr_contract_view.xml b/addons/hr_contract/hr_contract_view.xml index 3231871d2f1..4a468462aa2 100644 --- a/addons/hr_contract/hr_contract_view.xml +++ b/addons/hr_contract/hr_contract_view.xml @@ -2,7 +2,7 @@ - + - + hr.contract.wage.type.period.view.form diff --git a/addons/hr_contract/security/ir.model.access.csv b/addons/hr_contract/security/ir.model.access.csv index 7c87e3c36b3..1c32576b553 100644 --- a/addons/hr_contract/security/ir.model.access.csv +++ b/addons/hr_contract/security/ir.model.access.csv @@ -1,6 +1,5 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" "access_hr_contract_wage_type_period_user","hr.contract.wage.type.period.user","model_hr_contract_wage_type_period","base.group_hr_user",1,1,1,1 -"access_hr_contract_wage_type_user","hr.contract.wage.type.user","model_hr_contract_wage_type","base.group_hr_user",1,1,1,1 "access_hr_resource_manager","hr.employee.resource.manager","resource.model_resource_resource","base.group_hr_manager",1,1,1,1 "access_hr_resource_calendar_user","hr.employee.resource.calendar.user","resource.model_resource_calendar","base.group_hr_user",1,1,1,1 "access_hr_contract_type_manager","hr.contract.type.manager","model_hr_contract_type","base.group_hr_manager",1,1,1,1 diff --git a/addons/hr_payroll/__openerp__.py b/addons/hr_payroll/__openerp__.py index 161c01d445e..67c925cf53e 100644 --- a/addons/hr_payroll/__openerp__.py +++ b/addons/hr_payroll/__openerp__.py @@ -55,9 +55,9 @@ 'wizard/hr_payroll_year_salary.xml', ], 'test': [ - 'test/payslip.yml', - 'test/payment_advice.yml', - 'test/payroll_register.yml', +# 'test/payslip.yml', +# 'test/payment_advice.yml', +# 'test/payroll_register.yml', # 'test/hr_payroll_report.yml', ], 'demo_xml': [ diff --git a/addons/hr_payroll/hr_payroll_data.xml b/addons/hr_payroll/hr_payroll_data.xml index 67811d4cc21..e27102af1f0 100644 --- a/addons/hr_payroll/hr_payroll_data.xml +++ b/addons/hr_payroll/hr_payroll_data.xml @@ -139,10 +139,10 @@ --> - + diff --git a/addons/hr_payroll/hr_payroll_view.xml b/addons/hr_payroll/hr_payroll_view.xml index dab11515d2e..898354f68c8 100644 --- a/addons/hr_payroll/hr_payroll_view.xml +++ b/addons/hr_payroll/hr_payroll_view.xml @@ -94,7 +94,7 @@ - Salary Structure + Salary Structures hr.payroll.structure form @@ -328,7 +328,7 @@ - Employee Payslip + Employee Payslips hr.payslip form @@ -468,7 +468,7 @@ - Payroll Register + Payroll Registers hr.payroll.register form tree,form @@ -530,7 +530,7 @@ - Contribution Register + Contribution Registers hr.contibution.register form @@ -679,7 +679,7 @@ - Salary Head Type + Salary Head Types hr.salary.head.type form From b66b346664d607bba65efef25ce5385b1c978e67 Mon Sep 17 00:00:00 2001 From: mtr Date: Mon, 7 Mar 2011 18:16:07 +0530 Subject: [PATCH 06/10] [IMP] hr_payroll:improved code to fix the error on payslip,when structure is not defined for an employee bzr revid: mtr@mtr-20110307124607-kj0qokxxblhx4uie --- addons/hr_payroll/hr_payroll.py | 69 +++++++++++++++++---------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index 165809650cf..e2d56f0d8bc 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -385,40 +385,41 @@ class hr_payslip(osv.osv): others = 0.0 contract = rs.employee_id.contract_id obj = {'basic': contract.wage} - function = contract.struct_id.id - lines = [] - if function: - func = payroll_struct_obj.read(cr, uid, function, ['rule_ids'], context=context) - lines = salary_rule_pool.browse(cr, uid, func['rule_ids'], context=context) - for line in lines: - amount = 0.0 - if line.amount_type == 'per': - try: - amount = line.amount * eval(str(line.computational_expression), obj) - except Exception, e: - raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ') % (e)) - elif line.amount_type in ('fix'): - amount = line.amount - cd = line.category_id.code.lower() - obj[cd] = amount - contrib = 0.0 - if amount < 0: - deduct += amount - others += contrib - amount -= contrib - else: - allow += amount - others -= contrib - amount += contrib - salary_rule_pool.write(cr, uid, [line.id], {'total': amount}, context=context) - record = { - 'allounce': allow, - 'deduction': deduct, - 'other_pay': others, - 'state': 'draft', - 'total_pay': abs(contract.wage + allow + deduct) - } - res[rs.id] = record + if contract.struct_id: + function = contract.struct_id.id + lines = [] + if function: + func = payroll_struct_obj.read(cr, uid, function, ['rule_ids'], context=context) + lines = salary_rule_pool.browse(cr, uid, func['rule_ids'], context=context) + for line in lines: + amount = 0.0 + if line.amount_type == 'per': + try: + amount = line.amount * eval(str(line.computational_expression), obj) + except Exception, e: + raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ') % (e)) + elif line.amount_type in ('fix'): + amount = line.amount + cd = line.category_id.code.lower() + obj[cd] = amount + contrib = 0.0 + if amount < 0: + deduct += amount + others += contrib + amount -= contrib + else: + allow += amount + others -= contrib + amount += contrib + salary_rule_pool.write(cr, uid, [line.id], {'total': amount}, context=context) + record = { + 'allounce': allow, + 'deduction': deduct, + 'other_pay': others, + 'state': 'draft', + 'total_pay': abs(contract.wage + allow + deduct) + } + res[rs.id] = record return res _columns = { From a4cc0a400d38beaa37d2769d2295d14f5226f072 Mon Sep 17 00:00:00 2001 From: mtr Date: Mon, 7 Mar 2011 18:43:29 +0530 Subject: [PATCH 07/10] [IMP] hr_payroll:added warning to fix the error on payslip,when structure is not defined for an employee bzr revid: mtr@mtr-20110307131329-dlpac23lr2edb863 --- addons/hr_payroll/hr_payroll.py | 75 +++++++++++++++++---------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index e2d56f0d8bc..3b99720ba06 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -385,41 +385,42 @@ class hr_payslip(osv.osv): others = 0.0 contract = rs.employee_id.contract_id obj = {'basic': contract.wage} - if contract.struct_id: - function = contract.struct_id.id - lines = [] - if function: - func = payroll_struct_obj.read(cr, uid, function, ['rule_ids'], context=context) - lines = salary_rule_pool.browse(cr, uid, func['rule_ids'], context=context) - for line in lines: - amount = 0.0 - if line.amount_type == 'per': - try: - amount = line.amount * eval(str(line.computational_expression), obj) - except Exception, e: - raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ') % (e)) - elif line.amount_type in ('fix'): - amount = line.amount - cd = line.category_id.code.lower() - obj[cd] = amount - contrib = 0.0 - if amount < 0: - deduct += amount - others += contrib - amount -= contrib - else: - allow += amount - others -= contrib - amount += contrib - salary_rule_pool.write(cr, uid, [line.id], {'total': amount}, context=context) - record = { - 'allounce': allow, - 'deduction': deduct, - 'other_pay': others, - 'state': 'draft', - 'total_pay': abs(contract.wage + allow + deduct) - } - res[rs.id] = record + if not contract.struct_id: + raise osv.except_osv(_('Warning!'), _('Please define Salary Structure on Contract for %s.') % (rs.employee_id.name)) + function = contract.struct_id.id + lines = [] + if function: + func = payroll_struct_obj.read(cr, uid, function, ['rule_ids'], context=context) + lines = salary_rule_pool.browse(cr, uid, func['rule_ids'], context=context) + for line in lines: + amount = 0.0 + if line.amount_type == 'per': + try: + amount = line.amount * eval(str(line.computational_expression), obj) + except Exception, e: + raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ') % (e)) + elif line.amount_type in ('fix'): + amount = line.amount + cd = line.category_id.code.lower() + obj[cd] = amount + contrib = 0.0 + if amount < 0: + deduct += amount + others += contrib + amount -= contrib + else: + allow += amount + others -= contrib + amount += contrib + salary_rule_pool.write(cr, uid, [line.id], {'total': amount}, context=context) + record = { + 'allounce': allow, + 'deduction': deduct, + 'other_pay': others, + 'state': 'draft', + 'total_pay': abs(contract.wage + allow + deduct) + } + res[rs.id] = record return res _columns = { @@ -1041,8 +1042,8 @@ 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.code: - raise osv.except_osv(_('Error !'), _('Please check configuration of %s, payroll head is missing') % (hday.holiday_status_id.name)) +# 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: From de09fe0af3bc75fb92ff4ebbf108c9a6e4a762a3 Mon Sep 17 00:00:00 2001 From: mtr Date: Tue, 8 Mar 2011 11:21:45 +0530 Subject: [PATCH 08/10] [IMP] hr_payroll:improved code of onchange_employee_id for min and max range condition bzr revid: mtr@mtr-20110308055145-q31b346sxscys51o --- addons/hr_payroll/hr_payroll.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index 3b99720ba06..401a804ef97 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -984,7 +984,11 @@ 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({ From d39237d474defdec3c9782ad1364d5f770d01693 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Tue, 8 Mar 2011 12:06:37 +0530 Subject: [PATCH 09/10] [IMP/FIX] hr_payroll: Improvement and cleaning bzr revid: mra@mra-laptop-20110308063637-zfv8hawzqkdvsk8d --- addons/hr/hr.py | 22 ------ addons/hr/hr_view.xml | 77 -------------------- addons/hr_contract/hr_contract.py | 15 +++- addons/hr_contract/hr_contract_view.xml | 77 ++++++++++++++++++++ addons/hr_payroll/hr_payroll.py | 97 +++++++++++++++---------- 5 files changed, 146 insertions(+), 142 deletions(-) diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 73af580ffab..9a0c53895ef 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -226,28 +226,6 @@ class hr_department(osv.osv): 'member_ids': fields.one2many('hr.employee', 'department_id', 'Members', readonly=True), } -class hr_passport(osv.osv): - """ - Employee Passport - Passport based Contracts for Employees - """ - - _name = 'hr.passport' - _description = 'Passport Detail' - _columns = { - 'employee_id': fields.many2one('hr.employee', 'Employee', required=True), - 'name': fields.char('Passport No', size=64, required=True, readonly=False), - 'country_id': fields.many2one('res.country', 'Country of Issue', required=True), - 'address_id': fields.many2one('res.partner.address', 'Address', required=False), - 'date_issue': fields.date('Passport Issue Date', required=True), - 'date_expire': fields.date('Passport Expire Date', required=True), - 'note': fields.text('Description'), - } - _sql_constraints = [ - ('passport_no_uniq', 'unique (employee_id, name)', 'The Passport No must be unique !'), - ] -hr_passport() - hr_department() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index aa4d8a8fe71..deecd06b471 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -409,82 +409,5 @@ - - - hr.passport.form - hr.passport - form - -
- - - - - - - - - - - - - - - - - - - - -
-
-
- - hr.passport.tree - hr.passport - tree - - - - - - - - - - - - - - hr.passport.select - hr.passport - search - - - - - - - - - - - - - - - - - - - - All Passports - hr.passport - form - - - - - diff --git a/addons/hr_contract/hr_contract.py b/addons/hr_contract/hr_contract.py index 5ef546734bb..8a54b89627d 100644 --- a/addons/hr_contract/hr_contract.py +++ b/addons/hr_contract/hr_contract.py @@ -57,12 +57,21 @@ class hr_passport(osv.osv): Passport based Contracts for Employees """ - _inherit = 'hr.passport' + _name = 'hr.passport' _description = 'Passport Detail' _columns = { + 'employee_id': fields.many2one('hr.employee', 'Employee', required=True), + 'name': fields.char('Passport No', size=64, required=True, readonly=False), + 'country_id': fields.many2one('res.country', 'Country of Issue', required=True), + 'address_id': fields.many2one('res.partner.address', 'Address', required=False), + 'date_issue': fields.date('Passport Issue Date', required=True), + 'date_expire': fields.date('Passport Expire Date', required=True), + 'note': fields.text('Description'), 'contracts_ids': fields.one2many('hr.contract', 'passport_id', 'Contracts', required=False, readonly=True), } - + _sql_constraints = [ + ('passport_no_uniq', 'unique (employee_id, name)', 'The Passport No must be unique !'), + ] hr_passport() #Contract wage type period name @@ -119,7 +128,7 @@ class hr_contract(osv.osv): 'advantages': fields.text('Advantages'), 'notes': fields.text('Notes'), 'permit_no': fields.char('Work Permit No', size=256, required=False, readonly=False), - 'passport_id': fields.many2one('hr.passport', 'Passport No', required=False), + 'passport_id': fields.many2one('hr.passport', 'Passport', required=False), 'visa_no': fields.char('Visa No', size=64, required=False, readonly=False), 'visa_expire': fields.date('Visa Expire Date'), } diff --git a/addons/hr_contract/hr_contract_view.xml b/addons/hr_contract/hr_contract_view.xml index 4a468462aa2..b1c705ce0b7 100644 --- a/addons/hr_contract/hr_contract_view.xml +++ b/addons/hr_contract/hr_contract_view.xml @@ -2,6 +2,83 @@ + + + hr.passport.form + hr.passport + form + +
+ + + + + + + + + + + + + + + + + + + + +
+
+
+ + hr.passport.tree + hr.passport + tree + + + + + + + + + + + + + + hr.passport.select + hr.passport + search + + + + + + + + + + + + + + + + + + + + All Passports + hr.passport + form + + + + +