diff --git a/addons/l10n_in_hr_payroll/__openerp__.py b/addons/l10n_in_hr_payroll/__openerp__.py index 9762fac72c4..2143e914f7f 100644 --- a/addons/l10n_in_hr_payroll/__openerp__.py +++ b/addons/l10n_in_hr_payroll/__openerp__.py @@ -50,7 +50,7 @@ Indian Payroll Salary Rules. 'security/ir.model.access.csv', 'l10n_in_hr_payroll_report.xml', 'l10n_in_hr_payroll_sequence.xml', - 'wizard/salary_rule_bymonth.xml', + 'wizard/hr_salary_employee_bymonth.xml', 'report/payment_advice_report_view.xml', ], diff --git a/addons/l10n_in_hr_payroll/l10n_in_hr_payroll_report.xml b/addons/l10n_in_hr_payroll/l10n_in_hr_payroll_report.xml index ec7272675c2..04e7091e395 100644 --- a/addons/l10n_in_hr_payroll/l10n_in_hr_payroll_report.xml +++ b/addons/l10n_in_hr_payroll/l10n_in_hr_payroll_report.xml @@ -17,13 +17,13 @@ name="payroll.advice" rml="l10n_in_hr_payroll/report/report_payroll_advice.rml" string="Print Advice" /> - + + id="hr_salary_employee_bymonth" + model="hr.salary.employee.month" + name="salary.employee.bymonth" + rml="l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.rml" + string="Salary Register" /> diff --git a/addons/l10n_in_hr_payroll/report/__init__.py b/addons/l10n_in_hr_payroll/report/__init__.py index 344d91deb1a..3091692c2e8 100644 --- a/addons/l10n_in_hr_payroll/report/__init__.py +++ b/addons/l10n_in_hr_payroll/report/__init__.py @@ -24,8 +24,7 @@ import report_payslip_details import report_payroll_advice -import report_salary_rule_bymonth +import report_hr_salary_employee_bymonth import payment_advice_report - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_in_hr_payroll/report/report_salary_rule_bymonth.py b/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py similarity index 59% rename from addons/l10n_in_hr_payroll/report/report_salary_rule_bymonth.py rename to addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py index 4db8ce84c8f..947f17ecdc3 100644 --- a/addons/l10n_in_hr_payroll/report/report_salary_rule_bymonth.py +++ b/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py @@ -23,12 +23,12 @@ import datetime import time from report import report_sxw -import pooler -class report_salary_rule_bymonth(report_sxw.rml_parse): +class report_hr_salary_employee_bymonth(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(report_salary_rule_bymonth, self).__init__(cr, uid, name, context) + super(report_hr_salary_employee_bymonth, self).__init__(cr, uid, name, context=context) + self.localcontext.update({ 'time': time, 'get_employee': self.get_employee, @@ -37,47 +37,48 @@ class report_salary_rule_bymonth(report_sxw.rml_parse): 'get_total': self.get_total, }) + self.context = context self.mnths =[] - self.mnths_tol = [] + self.mnths_total = [] self.total=0.0 def get_periods(self, form): # Get start year-month-date and end year-month-date - fy = int(form['start_date'][0:4]) - ly = int(form['end_date'][0:4]) + first_year = int(form['start_date'][0:4]) + last_year = int(form['end_date'][0:4]) - fm = int(form['start_date'][5:7]) - lm = int(form['end_date'][5:7]) - no_months = (ly-fy)*12+lm-fm + 1 - cm = fm - cy = fy + first_month = int(form['start_date'][5:7]) + last_month = int(form['end_date'][5:7]) + no_months = (last_year-first_year) * 12 + last_month - first_month + 1 + current_month = first_month + current_year = first_year # Get name of the months from integer mnth_name = [] for count in range(0, no_months): - m = datetime.date(cy, cm, 1).strftime('%b') + m = datetime.date(current_year, current_month, 1).strftime('%b') mnth_name.append(m) - self.mnths.append(str(cm)+'-'+str(cy)) - if cm == 12: - cm = 0 - cy = ly - cm = cm +1 + self.mnths.append(str(current_month)+'-'+str(current_year)) + if current_month == 12: + current_month = 0 + current_year = last_year + current_month = current_month +1 for c in range(0, (12-no_months)): mnth_name.append('None') self.mnths.append('None') return [mnth_name] def get_employee(self, form): - ls1=[] - ls = [] - tol_mnths=['Total', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - emp = pooler.get_pool(self.cr.dbname).get('hr.employee') - emp_ids = form['employee_ids'] - empll = emp.browse(self.cr, self.uid, emp_ids) + list1=[] + list = [] + total_mnths=['Total', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + emp_obj = self.pool.get('hr.employee') + emp_ids = form.get('employee_ids', []) + employees = emp_obj.browse(self.cr, self.uid, emp_ids, context=self.context) cnt = 1 - for emp_id in empll: - ls1.append(emp_id.name) - tol = 0.0 + for emp_id in employees: + list1.append(emp_id.name) + total = 0.0 for mnth in self.mnths: if mnth <> 'None': if len(mnth) != 7: @@ -90,35 +91,35 @@ class report_salary_rule_bymonth(report_sxw.rml_parse): where pl.code = 'NET' and p.state = 'done' and p.employee_id = '''+str(emp_id.id)+''' \ and to_char(date_to,'mm-yyyy') like '%'''+mnth+'''%' group by r.name, p.date_to,emp.id''') - sal = self.cr.fetchall() - if sal: - ls1.append(sal[0][0]) - tol += sal[0][0] - tol_mnths[cnt] = tol_mnths[cnt] + sal[0][0] + salary = self.cr.fetchall() + if salary: + list1.append(salary[0][0]) + total += salary[0][0] + total_mnths[cnt] = total_mnths[cnt] + salary[0][0] else: - ls1.append(0.00) + list1.append(0.00) else: - ls1.append('') - tol_mnths[cnt] = '' + list1.append('') + total_mnths[cnt] = '' cnt = cnt + 1 cnt = 1 - ls1.append(tol) - ls.append(ls1) - ls1 = [] - self.mnths_tol.append(tol_mnths) - return ls + list1.append(total) + list.append(list1) + list1 = [] + self.mnths_total.append(total_mnths) + return list def get_months_tol(self): - return self.mnths_tol + return self.mnths_total def get_total(self): - for item in self.mnths_tol: + for item in self.mnths_total: for count in range(1, len(item)): if item[count] == '': continue self.total += item[count] return self.total -report_sxw.report_sxw('report.salary.rule.bymonth', 'salary.rule.month', 'l10n_in_hr_payroll/report/report_salary_rule_bymonth.rml', parser=report_salary_rule_bymonth, header='internal') +report_sxw.report_sxw('report.salary.employee.bymonth', 'hr.salary.employee.month', 'l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.rml', parser=report_hr_salary_employee_bymonth, header='internal') # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_in_hr_payroll/report/report_salary_rule_bymonth.rml b/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.rml similarity index 96% rename from addons/l10n_in_hr_payroll/report/report_salary_rule_bymonth.rml rename to addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.rml index b50d53cfe9b..73d224e65b0 100644 --- a/addons/l10n_in_hr_payroll/report/report_salary_rule_bymonth.rml +++ b/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.rml @@ -2,7 +2,7 @@ @@ -106,7 +106,7 @@ - + @@ -117,7 +117,7 @@ From [[ formatLang(data['form']['start_date'], date=True) ]] To [[ formatLang(data['form']['end_date'], date=True) ]]
[[ repeatIn(get_periods(data['form']),'m') ]] - + Name @@ -165,7 +165,7 @@
[[ repeatIn(get_employee(data['form']),'e') ]] - + [[ e[0] ]] @@ -235,17 +235,11 @@ - - -
- - -
[[ repeatIn(get_months_tol(),'t') ]] - + Total @@ -291,12 +285,6 @@ - - -
- - -
diff --git a/addons/l10n_in_hr_payroll/wizard/__init__.py b/addons/l10n_in_hr_payroll/wizard/__init__.py index 26d42354c53..b08ed5a3f9c 100644 --- a/addons/l10n_in_hr_payroll/wizard/__init__.py +++ b/addons/l10n_in_hr_payroll/wizard/__init__.py @@ -19,6 +19,6 @@ # ############################################################################## -import salary_rule_bymonth +import hr_salary_employee_bymonth # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_in_hr_payroll/wizard/salary_rule_bymonth.py b/addons/l10n_in_hr_payroll/wizard/hr_salary_employee_bymonth.py similarity index 86% rename from addons/l10n_in_hr_payroll/wizard/salary_rule_bymonth.py rename to addons/l10n_in_hr_payroll/wizard/hr_salary_employee_bymonth.py index e09fc1f885f..172824a77cb 100644 --- a/addons/l10n_in_hr_payroll/wizard/salary_rule_bymonth.py +++ b/addons/l10n_in_hr_payroll/wizard/hr_salary_employee_bymonth.py @@ -23,15 +23,14 @@ import time from osv import osv, fields -class salary_rule_bymonth(osv.osv_memory): +class hr_salary_employee_bymonth(osv.osv_memory): - _name = 'salary.rule.month' - _description = 'Print Monthly Salary Rule Report' + _name = 'hr.salary.employee.month' + _description = 'Print Hr Salary Employee By Month Report' _columns = { 'start_date': fields.date('Starting Date', required=True), 'end_date': fields.date('Ending Date', required=True), 'employee_ids': fields.many2many('hr.employee', 'payroll_year_rel', 'payroll_year_id', 'emp_id', 'Employees', required=True), -# 'rule_id': fields.many2one('hr.salary.rule.category', 'Rule Category', required=True), } _defaults = { @@ -55,13 +54,13 @@ class salary_rule_bymonth(osv.osv_memory): res = self.read(cr, uid, ids, ['employee_ids', 'start_date', 'end_date'], context=context) res = res and res[0] or {} datas['form'] = res - datas['ids'] = res.get('employee_ids', []) + res['employee_ids'] = res.get('employee_ids', []) return { 'type': 'ir.actions.report.xml', - 'report_name': 'salary.rule.bymonth', + 'report_name': 'salary.employee.bymonth', 'datas': datas, } -salary_rule_bymonth() +hr_salary_employee_bymonth() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_in_hr_payroll/wizard/salary_rule_bymonth.xml b/addons/l10n_in_hr_payroll/wizard/hr_salary_employee_bymonth.xml similarity index 59% rename from addons/l10n_in_hr_payroll/wizard/salary_rule_bymonth.xml rename to addons/l10n_in_hr_payroll/wizard/hr_salary_employee_bymonth.xml index c1386f824be..859506921e7 100644 --- a/addons/l10n_in_hr_payroll/wizard/salary_rule_bymonth.xml +++ b/addons/l10n_in_hr_payroll/wizard/hr_salary_employee_bymonth.xml @@ -1,30 +1,30 @@ - - Salary rule monthly - salary.rule.month + + Hr monthly Employee Salary + hr.salary.employee.month form -
+
+
- + Salary Register ir.actions.act_window - salary.rule.month + hr.salary.employee.month form form new @@ -33,14 +33,14 @@