parent
e136fba798
commit
adcd986ebf
|
@ -24,6 +24,6 @@
|
|||
model="salary.rule.month"
|
||||
name="salary.rule.bymonth"
|
||||
rml="l10n_in_hr_payroll/report/report_salary_rule_bymonth.rml"
|
||||
string="rule by month" />
|
||||
string="Yearly Salary Report" />
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
#-*- coding:utf-8 -*-
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# d$
|
||||
# Copyright (C) 2011 OpenERP SA (<http://openerp.com>). All Rights Reserved
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -22,8 +20,9 @@
|
|||
##############################################################################
|
||||
|
||||
import datetime
|
||||
from report import report_sxw
|
||||
import time
|
||||
|
||||
from report import report_sxw
|
||||
import pooler
|
||||
|
||||
class report_salary_rule_bymonth(report_sxw.rml_parse):
|
||||
|
@ -42,7 +41,7 @@ class report_salary_rule_bymonth(report_sxw.rml_parse):
|
|||
self.mnths_tol = []
|
||||
self.total=0.0
|
||||
|
||||
def get_periods(self,form):
|
||||
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])
|
||||
|
@ -55,7 +54,7 @@ class report_salary_rule_bymonth(report_sxw.rml_parse):
|
|||
|
||||
# Get name of the months from integer
|
||||
mnth_name = []
|
||||
for count in range(0,no_months):
|
||||
for count in range(0, no_months):
|
||||
m = datetime.date(cy, cm, 1).strftime('%b')
|
||||
mnth_name.append(m)
|
||||
self.mnths.append(str(cm)+'-'+str(cy))
|
||||
|
@ -63,18 +62,18 @@ class report_salary_rule_bymonth(report_sxw.rml_parse):
|
|||
cm = 0
|
||||
cy = ly
|
||||
cm = cm +1
|
||||
for c in range(0,(12-no_months)):
|
||||
for c in range(0, (12-no_months)):
|
||||
mnth_name.append('None')
|
||||
self.mnths.append('None')
|
||||
return [mnth_name]
|
||||
|
||||
def get_employee(self,form):
|
||||
def get_employee(self, form):
|
||||
ls1=[]
|
||||
ls = []
|
||||
tol_mnths=['Total',0,0,0,0,0,0,0,0,0,0,0,0]
|
||||
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)
|
||||
empll = emp.browse(self.cr, self.uid, emp_ids)
|
||||
cnt = 1
|
||||
for emp_id in empll:
|
||||
ls1.append(emp_id.name)
|
||||
|
@ -91,7 +90,6 @@ class report_salary_rule_bymonth(report_sxw.rml_parse):
|
|||
where (pl.code = 'NET') 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''')
|
||||
# self.cr.execute(query)
|
||||
sal = self.cr.fetchall()
|
||||
if sal:
|
||||
ls1.append(sal[0][0])
|
||||
|
@ -116,7 +114,7 @@ class report_salary_rule_bymonth(report_sxw.rml_parse):
|
|||
|
||||
def get_total(self):
|
||||
for item in self.mnths_tol:
|
||||
for count in range(1,len(item)):
|
||||
for count in range(1, len(item)):
|
||||
if item[count] == '':
|
||||
continue
|
||||
self.total += item[count]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<document filename="test.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<document filename="yearly salary report.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Yearly Salary Report" author="OpenERP" allowSplitting="20">
|
||||
<pageTemplate id="first">
|
||||
<frame id="first" x1="28.0" y1="28.0" width="400" height="786"/>
|
||||
</pageTemplate>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
###############################################################################
|
||||
#-*- coding:utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
# Copyright (C) 2011 OpenERP SA (<http://openerp.com>). All Rights Reserved
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -24,15 +24,16 @@ import time
|
|||
from osv import osv, fields
|
||||
|
||||
class salary_rule_bymonth(osv.osv_memory):
|
||||
|
||||
_name = 'salary.rule.month'
|
||||
# _inherit = 'hr.employee'
|
||||
_description = 'Print Monthly Salary Rule 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),
|
||||
'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 = {
|
||||
'start_date': lambda *a: time.strftime('%Y-01-01'),
|
||||
'end_date': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
|
@ -51,10 +52,10 @@ class salary_rule_bymonth(osv.osv_memory):
|
|||
context = {}
|
||||
datas = {'ids': context.get('active_ids', [])}
|
||||
|
||||
res = self.read(cr, uid, ids, ['employee_ids', 'start_date', 'end_date', ], context=context)
|
||||
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',[])
|
||||
datas['ids'] = res.get('employee_ids', [])
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'salary.rule.bymonth',
|
||||
|
|
|
@ -29,27 +29,19 @@
|
|||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="hr_attendance_week_values">
|
||||
<field name="model_id" ref="hr_payroll.model_hr_salary_rule_category" />
|
||||
<field name="name">Salary rule monthly</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_salary_rule_month'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">salary.rule.month</field>
|
||||
</record>
|
||||
|
||||
|
||||
<menuitem
|
||||
name="Report"
|
||||
name="Reporting"
|
||||
parent="hr.menu_hr_root"
|
||||
id="menu_monthly_salary_rule_report" sequence="50"
|
||||
/>
|
||||
|
||||
<menuitem
|
||||
name="Monthly salary rule report"
|
||||
name="Monthly Salary Rule Report"
|
||||
parent="menu_monthly_salary_rule_report"
|
||||
action="action_salary_rule_month"
|
||||
id="menu_monthly_salary_rule"
|
||||
/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue