From 00495a0bf6e210e004310420ae06b85cf8ffc705 Mon Sep 17 00:00:00 2001 From: mtr Date: Wed, 13 Apr 2011 18:46:28 +0530 Subject: [PATCH] [IMP] hr_payroll_account: removed unrequired objects and added fields as per etherpad bzr revid: mtr@mtr-20110413131628-wp4km4zwuatfjn63 --- addons/hr_payroll_account/__openerp__.py | 2 +- .../hr_payroll_account/hr_payroll_account.py | 206 ++++++++++-------- .../hr_payroll_account_view.xml | 168 ++++++-------- 3 files changed, 184 insertions(+), 192 deletions(-) diff --git a/addons/hr_payroll_account/__openerp__.py b/addons/hr_payroll_account/__openerp__.py index 30dcd9e7b55..5134529901d 100644 --- a/addons/hr_payroll_account/__openerp__.py +++ b/addons/hr_payroll_account/__openerp__.py @@ -46,7 +46,7 @@ Generic Payroll system Integrated with Accountings. "hr_payroll_account_view.xml", ], 'demo_xml': [ - 'hr_payroll_demo.xml' +# 'hr_payroll_demo.xml' ], 'installable': True, 'active': False, diff --git a/addons/hr_payroll_account/hr_payroll_account.py b/addons/hr_payroll_account/hr_payroll_account.py index 045063a7284..07d05fd5363 100644 --- a/addons/hr_payroll_account/hr_payroll_account.py +++ b/addons/hr_payroll_account/hr_payroll_account.py @@ -94,90 +94,90 @@ class hr_employee(osv.osv): } hr_employee() -class payroll_register(osv.osv): - _inherit = 'hr.payroll.register' - _description = 'Payroll Register' +#class payroll_register(osv.osv): +# _inherit = 'hr.payroll.register' +# _description = 'Payroll Register' +# +# _columns = { +# 'journal_id': fields.many2one('account.journal', 'Expense Journal'), +# 'bank_journal_id': fields.many2one('account.journal', 'Bank Journal'), +# 'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(Payslip) date."), +# } +# +# def compute_sheet(self, cr, uid, ids, context=None): +# emp_pool = self.pool.get('hr.employee') +# slip_pool = self.pool.get('hr.payslip') +# func_pool = self.pool.get('hr.payroll.structure') +# slip_line_pool = self.pool.get('hr.payslip.line') +# wf_service = netsvc.LocalService("workflow") +# vals = self.browse(cr, uid, ids, context=context)[0] +# emp_ids = emp_pool.search(cr, uid, []) +# +# for emp in emp_pool.browse(cr, uid, emp_ids, context=context): +# old_slips = slip_pool.search(cr, uid, [('employee_id','=', emp.id), ('date','=',vals.date)]) +# if old_slips: +# slip_pool.write(cr, uid, old_slips, {'register_id':ids[0]}) +# for sid in old_slips: +# wf_service.trg_validate(uid, 'hr.payslip', sid, 'compute_sheet', cr) +# else: +# res = { +# 'employee_id':emp.id, +# 'basic':0.0, +# 'register_id':ids[0], +# 'name':vals.name, +# 'date':vals.date, +# 'journal_id':vals.journal_id.id, +# 'bank_journal_id':vals.bank_journal_id.id +# } +# slip_id = slip_pool.create(cr, uid, res) +# 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}) +# return True +# +#payroll_register() - _columns = { - 'journal_id': fields.many2one('account.journal', 'Expense Journal'), - 'bank_journal_id': fields.many2one('account.journal', 'Bank Journal'), - 'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(Payslip) date."), - } - - def compute_sheet(self, cr, uid, ids, context=None): - emp_pool = self.pool.get('hr.employee') - slip_pool = self.pool.get('hr.payslip') - func_pool = self.pool.get('hr.payroll.structure') - slip_line_pool = self.pool.get('hr.payslip.line') - wf_service = netsvc.LocalService("workflow") - vals = self.browse(cr, uid, ids, context=context)[0] - emp_ids = emp_pool.search(cr, uid, []) - - for emp in emp_pool.browse(cr, uid, emp_ids, context=context): - old_slips = slip_pool.search(cr, uid, [('employee_id','=', emp.id), ('date','=',vals.date)]) - if old_slips: - slip_pool.write(cr, uid, old_slips, {'register_id':ids[0]}) - for sid in old_slips: - wf_service.trg_validate(uid, 'hr.payslip', sid, 'compute_sheet', cr) - else: - res = { - 'employee_id':emp.id, - 'basic':0.0, - 'register_id':ids[0], - 'name':vals.name, - 'date':vals.date, - 'journal_id':vals.journal_id.id, - 'bank_journal_id':vals.bank_journal_id.id - } - slip_id = slip_pool.create(cr, uid, res) - 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}) - return True - -payroll_register() - -class payroll_advice(osv.osv): - _inherit = 'hr.payroll.advice' - _description = 'Bank Advice Note' - - _columns = { - 'account_id': fields.many2one('account.account', 'Account'), - } -payroll_advice() +#class payroll_advice(osv.osv): +# _inherit = 'hr.payroll.advice' +# _description = 'Bank Advice Note' +# +# _columns = { +# 'account_id': fields.many2one('account.account', 'Account'), +# } +#payroll_advice() class contrib_register(osv.osv): - _inherit = 'hr.contibution.register' + _inherit = 'hr.contribution.register' _description = 'Contribution Register' def _total_contrib(self, cr, uid, ids, field_names, arg, context=None): - line_pool = self.pool.get('hr.contibution.register.line') +# line_pool = self.pool.get('hr.contibution.register.line') period_id = self.pool.get('account.period').search(cr,uid,[('date_start','<=',time.strftime('%Y-%m-%d')),('date_stop','>=',time.strftime('%Y-%m-%d'))])[0] fiscalyear_id = self.pool.get('account.period').browse(cr, uid, period_id, context=context).fiscalyear_id res = {} - for cur in self.browse(cr, uid, ids, context=context): - current = line_pool.search(cr, uid, [('period_id','=',period_id),('register_id','=',cur.id)]) - years = line_pool.search(cr, uid, [('period_id.fiscalyear_id','=',fiscalyear_id.id), ('register_id','=',cur.id)]) - - e_month = 0.0 - c_month = 0.0 - for i in line_pool.browse(cr, uid, current, context=context): - e_month += i.emp_deduction - c_month += i.comp_deduction - - e_year = 0.0 - c_year = 0.0 - for j in line_pool.browse(cr, uid, years, context=context): - e_year += i.emp_deduction - c_year += i.comp_deduction - - res[cur.id]={ - 'monthly_total_by_emp':e_month, - 'monthly_total_by_comp':c_month, - 'yearly_total_by_emp':e_year, - 'yearly_total_by_comp':c_year - } +# for cur in self.browse(cr, uid, ids, context=context): +# current = line_pool.search(cr, uid, [('period_id','=',period_id),('register_id','=',cur.id)]) +# years = line_pool.search(cr, uid, [('period_id.fiscalyear_id','=',fiscalyear_id.id), ('register_id','=',cur.id)]) +# +# e_month = 0.0 +# c_month = 0.0 +# for i in line_pool.browse(cr, uid, current, context=context): +# e_month += i.emp_deduction +# c_month += i.comp_deduction +# +# e_year = 0.0 +# c_year = 0.0 +# for j in line_pool.browse(cr, uid, years, context=context): +# e_year += i.emp_deduction +# c_year += i.comp_deduction +# +# res[cur.id]={ +# 'monthly_total_by_emp':e_month, +# 'monthly_total_by_comp':c_month, +# 'yearly_total_by_emp':e_year, +# 'yearly_total_by_comp':c_year +# } return res _columns = { @@ -188,22 +188,22 @@ class contrib_register(osv.osv): } contrib_register() -class contrib_register_line(osv.osv): - _inherit = 'hr.contibution.register.line' - _description = 'Contribution Register Line' +#class contrib_register_line(osv.osv): +# _inherit = 'hr.contibution.register.line' +# _description = 'Contribution Register Line' +# +# _columns = { +# 'period_id': fields.many2one('account.period', 'Period'), +# } +#contrib_register_line() - _columns = { - 'period_id': fields.many2one('account.period', 'Period'), - } -contrib_register_line() - -class hr_holidays_status(osv.osv): - _inherit = 'hr.holidays.status' - _columns = { - 'account_id': fields.many2one('account.account', 'Account'), - 'analytic_account_id':fields.many2one('account.analytic.account', 'Analytic Account'), - } -hr_holidays_status() +#class hr_holidays_status(osv.osv): +# _inherit = 'hr.holidays.status' +# _columns = { +# 'account_id': fields.many2one('account.account', 'Account'), +# 'analytic_account_id':fields.many2one('account.analytic.account', 'Analytic Account'), +# } +#hr_holidays_status() class hr_payslip(osv.osv): ''' @@ -449,11 +449,11 @@ class hr_payslip(osv.osv): fiscal_year_objs = fiscalyear_pool.read(cr, uid, fiscal_year_ids, ['date_start','date_stop'], context=context) year_exist = False for fiscal_year in fiscal_year_objs: - if ((fiscal_year['date_start'] <= slip.date) and (fiscal_year['date_stop'] >= slip.date)): + if ((fiscal_year['date_start'] <= slip.date_from) and (fiscal_year['date_stop'] >= slip.date_to)): year_exist = True if not year_exist: raise osv.except_osv(_('Warning !'), _('Fiscal Year is not defined for slip date %s') % slip.date) - search_periods = period_pool.search(cr,uid,[('date_start','<=',slip.date),('date_stop','>=',slip.date)], context=context) + search_periods = period_pool.search(cr,uid,[('date_start','=',slip.date_from),('date_stop','=',slip.date_to)], context=context) if not search_periods: raise osv.except_osv(_('Warning !'), _('Period is not defined for slip date %s') % slip.date) period_id = search_periods[0] @@ -661,6 +661,17 @@ class hr_payslip_line(osv.osv): } hr_payslip_line() +class hr_salary_rule(osv.osv): + _inherit = 'hr.salary.rule' + _columns = { +# 'account_id': fields.many2one('account.account', 'General Account'), + 'analytic_account_id':fields.many2one('account.analytic.account', 'Analytic Account'), + 'account_tax_id':fields.many2one('account.tax.code', 'Tax Code'), + 'account_debit': fields.many2one('account.account', 'Debit Account'), + 'account_credit': fields.many2one('account.account', 'Credit Account'), + } +hr_salary_rule() + class account_move_link_slip(osv.osv): ''' Account Move Link to Pay Slip @@ -675,4 +686,15 @@ class account_move_link_slip(osv.osv): } account_move_link_slip() +class hr_contract(osv.osv): + + _inherit = 'hr.contract' + _description = 'Employee Contract' + _columns = { + 'analytic_account_id':fields.many2one('account.analytic.account', 'Analytic Account'), + 'journal_id': fields.many2one('account.journal', 'Journal'), + } +hr_contract() + + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_payroll_account/hr_payroll_account_view.xml b/addons/hr_payroll_account/hr_payroll_account_view.xml index d2ad309dc32..e290f94bcac 100644 --- a/addons/hr_payroll_account/hr_payroll_account_view.xml +++ b/addons/hr_payroll_account/hr_payroll_account_view.xml @@ -2,22 +2,6 @@ - - - hr.holidays.status.inherit1 - hr.holidays.status - - form - - - - - - - - - - hr.payslip.line.inherit.tree hr.payslip.line @@ -44,7 +28,7 @@ - + hr.payslip.inherit.form @@ -62,7 +46,7 @@ form - + @@ -87,51 +71,13 @@ - - hr.payroll.advice.inherit.form - hr.payroll.advice - - form + + hr.contribution.register.inherit.tree + hr.contribution.register + + tree - - - - - - - hr.payroll.register.inherit.tree - hr.payroll.register - - tree - - - - - - - - - - hr.payroll.register.inherit.form - hr.payroll.register - - form - - - - - - - - - - hr.contibution.register.inherit.tree - hr.contibution.register - - tree - - @@ -139,45 +85,35 @@ - hr.contibution.register.inherit.form - hr.contibution.register - + hr.contribution.register.inherit.form + hr.contribution.register + form - - - - + + + + + - - hr.contibution.register.inherit1.form - hr.contibution.register - + hr.payslip.form @@ -185,7 +121,7 @@ form - + @@ -203,18 +139,18 @@ - - - - - - + + + + + + - - + + - - + + @@ -251,5 +187,39 @@ + + + + hr.salary.rule.form.inherit + hr.salary.rule + + + + + + + + + + + + + + + + + hr.contract.view.form.inherit + hr.contract + form + + + + + + + + + +