[MERGE] hr_payroll: branch merge for sbh => osv memory conversion and search view

bzr revid: mra@mra-laptop-20100701073146-ms0xdv7pvx7fsbzt
This commit is contained in:
Mustufa Rangwala 2010-07-01 13:01:46 +05:30
commit fc210d0b95
18 changed files with 718 additions and 494 deletions

View File

@ -2,7 +2,7 @@
#-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
@ -23,4 +23,6 @@
import hr_payroll
import report
import wizard
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,7 +1,7 @@
#-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
@ -38,7 +38,7 @@
'depends': [
'hr',
'account',
'hr_contract',
'hr_contract',
'hr_holidays',
'hr_expense'
],
@ -50,7 +50,10 @@
'hr_payroll_sequence.xml',
'hr_paroll_report.xml',
'hr_payroll_data.xml',
'hr_payroll_wizard.xml'
'wizard/hr_payroll_create_analytic.xml',
'wizard/hr_payroll_employees_detail.xml',
'wizard/hr_payroll_year_salary.xml',
],
'demo_xml': [
'hr_payroll_demo.xml'
@ -58,3 +61,5 @@
'installable': True,
'active': False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,8 @@
<!-- Root Menus -->
<menuitem id="menu_hr_root_payroll" parent="hr.menu_hr_root" name="Payroll"/>
<menuitem id="payroll_configure" parent="hr.menu_hr_configuration" name="Payroll"/>
<menuitem id="menu_hr_payroll_reporting" parent="hr.menu_hr_reporting" name="Payroll"/>
<!-- Passport Views -->
<record id="hr_passport_form" model="ir.ui.view">
@ -14,7 +16,7 @@
<form string="Passport">
<group col="6" colspan="4">
<field name="name" select="1" colspan="4"/>
<field name="employee_id" select="1"/>
<field name="employee_id" />
</group>
<group col="2" colspan="2">
<separator string="Country &amp; Address" colspan="4"/>
@ -44,19 +46,45 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Passport">
<field name="name" select="1"/>
<field name="employee_id" select="1"/>
<field name="country_id" select="1"/>
<field name="date_expire" select="1"/>
<field name="date_expire" select="1"/>
<field name="name" />
<field name="employee_id" />
<field name="address_id"/>
<field name="country_id" />
<field name="date_expire"/>
<field name="date_issue" />
</tree>
</field>
</record>
<record id="view_hr_passport_filter" model="ir.ui.view">
<field name="name">hr.passport.select</field>
<field name="model">hr.passport</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Passport">
<group col="8" colspan="4">
<separator orientation="vertical"/>
<field name="name"/>
<field name="employee_id"/>
<field name="country_id"/>
<field name="address_id"/>
</group>
<newline/>
<group col="8" colspan="4" expand="0" string="Group By...">
<filter string="Employees" icon="terp-partner" name="employee_id" context="{'group_by':'employee_id'}"/>
<filter string="Country" name="country_id" icon="terp-go-home" context="{'group_by':'country_id'}"/>
<filter string="Expire" name="date_expire" icon="terp-go-month" context="{'group_by':'date_expire'}"/>
<filter string="Issue" name="date_issue" icon="terp-go-month" context="{'group_by':'date_issue'}"/>
</group>
</search>
</field>
</record>
<record id="action_hr_passport_tree" model="ir.actions.act_window">
<field name="name">All Passports</field>
<field name="res_model">hr.passport</field>
<field name="view_type">form</field>
<field name="view_id" ref="hr_passport_tree"/>
<field name="search_view_id" ref="view_hr_passport_filter"/>
</record>
<menuitem id="passport_configure" parent="hr.menu_hr_configuration" name="Passport"/>
<menuitem
@ -583,11 +611,34 @@
</tree>
</field>
</record>
<record id="view_allounce_deduction_categoty_filter" model="ir.ui.view">
<field name="name">hr.allounce.deduction.categoty.select</field>
<field name="model">hr.allounce.deduction.categoty</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Salary Heads">
<filter icon="terp-document-new" string="Allowance" domain="[('type','=','allowance')]"/>
<filter icon="terp-check" string="Deduction" domain="[('type','=','deduction')]"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="type"/>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="4" groups="base.group_extended">
<filter string="Based" icon="terp-go-month" domain="[]" context="{'group_by':'base'}"/>
<filter string="Type" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'type'}"/>
</group>
</search>
</field>
</record>
<record id="hr_allounce_deduction_tree" model="ir.actions.act_window">
<field name="name">Salary Heads</field>
<field name="res_model">hr.allounce.deduction.categoty</field>
<field name="view_type">form</field>
<field name="view_id" ref="hr_allounce_deduction_categoty_tree"/>
<field name="search_view_id" ref="view_allounce_deduction_categoty_filter"/>
</record>
<menuitem
id="menu_hr_allounce_deduction_tree"
@ -652,14 +703,40 @@
<field name="contribute_per"/>
<field name="amount_type"/>
<field name="register_id"/>
<field name="category_id"/>
</tree>
</field>
</record>
<record id="view_hr_company_contribution_filter" model="ir.ui.view">
<field name="name">company.contribution.select</field>
<field name="model">company.contribution</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Company Contribution">
<group col="8" colspan="4">
<filter icon="terp-document-new" string="Fixed Amount" domain="[('amount_type','=','fix')]" help="Draft Slip"/>
<filter icon="terp-camera_test" string="Function Calculation" domain="[('amount_type','=','func')]" help="Posted Slip"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="code"/>
<field name="contribute_per"/>
<field name="register_id"/>
</group>
<newline/>
<group col="8" colspan="4" expand="0" string="Group By...">
<filter string="Type" icon="terp-partner" name="amount_type" context="{'group_by':'amount_type'}"/>
<filter string="Category" name="category_id" icon="terp-go-month" context="{'group_by':'category_id'}"/>
</group>
</search>
</field>
</record>
<record id="action_hr_company_contribution_tree" model="ir.actions.act_window">
<field name="name">Company Contributions</field>
<field name="res_model">company.contribution</field>
<field name="view_type">form</field>
<field name="view_id" ref="hr_company_contribution_tree"/>
<field name="search_view_id" ref="view_hr_company_contribution_filter"/>
</record>
<menuitem
id="menu_hr_company_contribution_tree"
@ -763,9 +840,9 @@
</notebook>
<group col="6" colspan="6">
<field name="state"/>
<button name="confirm_sheet" string="Confirm Sheet" states="draft" type="object"/>
<button name="set_to_draft" string="Set to Draft" states="cancel,confirm" type="object"/>
<button name="cancel_sheet" string="Cancel Sheet" states="draft" type="object"/>
<button name="confirm_sheet" icon="gtk-apply" string="Confirm Sheet" states="draft" type="object"/>
<button name="set_to_draft" string="Set to Draft" icon="gtk-convert" states="cancel,confirm" type="object"/>
<button name="cancel_sheet" string="Cancel Sheet" states="draft" icon="gtk-cancel" type="object"/>
</group>
</form>
</field>
@ -842,13 +919,13 @@
</notebook>
<group col="8" colspan="4">
<field name="state"/>
<button string="Compute" name="compute_sheet" states="new" type="object"/>
<button string="Verify Sheet" name="verify_sheet" states="draft" type="object"/>
<button string="Complete HR Checking" name="verify_twice_sheet" type="object" states="hr_check"/>
<button string="Complete Accountant Checking" name="final_verify_sheet" states="accont_check" type="object"/>
<button string="Pay Salary" name="process_sheet" states="confirm" type="object"/>
<button string="Cancel" name="cancel_sheet" states="draft,hr_check,accont_check,confirm" type="object"/>
<button string="Set to Draft" name="set_to_draft" states="cancel" type="object"/>
<button string="Compute" name="compute_sheet" states="new" icon="terp-document-new" type="object"/>
<button string="Verify Sheet" icon="gtk-ok" name="verify_sheet" states="draft" type="object"/>
<button string="Complete HR Checking" icon="gtk-apply" name="verify_twice_sheet" type="object" states="hr_check"/>
<button string="Complete Accountant Checking" icon="gtk-apply" name="final_verify_sheet" states="accont_check" type="object"/>
<button string="Pay Salary" icon="gtk-apply" name="process_sheet" states="confirm" type="object" />
<button string="Cancel" name="cancel_sheet" icon="gtk-cancel" states="draft,hr_check,accont_check,confirm" type="object"/>
<button string="Set to Draft" name="set_to_draft" states="cancel" type="object" icon="gtk-convert" />
</group>
</form>
</field>

View File

@ -3,7 +3,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
@ -28,7 +28,7 @@ from report import report_sxw
from tools import amount_to_text_en
class salary_structure_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(salary_structure_report, self).__init__(cr, uid, name, context)
self.localcontext.update({
@ -38,7 +38,7 @@ class salary_structure_report(report_sxw.rml_parse):
'get_line_amount_type':self.get_line_amount_type,
'get_line_type':self.get_line_type
})
def get_contract(self,emp):
curr_date = "'"+time.strftime("%Y-%m-%d")+"'"
sql_req= '''
@ -59,16 +59,16 @@ class salary_structure_report(report_sxw.rml_parse):
return []
contract = self.pool.get('hr.contract').browse(self.cr, self.uid, [contract_id['id']])
return contract
def get_type(self,type):
return type[0].swapcase() + type[1:] +' Salary'
def get_line_amount_type(self,amount_type):
if amount_type == 'per':
return 'Percent(%)'
else:
return 'Fixed'
def get_line_type(self,type):
if type == 'allounce':
return 'Allowance'
@ -83,8 +83,7 @@ class salary_structure_report(report_sxw.rml_parse):
else:
return 'Other Deduction'
report_sxw.report_sxw('report.salary.structure', 'hr.employee', 'hr_payroll/report/report_emp_salary_structure.rml', parser=salary_structure_report)
report_sxw.report_sxw('report.salary.structure', 'hr.employee', 'hr_payroll/report/report_emp_salary_structure.rml', parser=salary_structure_report)
@ -93,6 +92,7 @@ report_sxw.report_sxw('report.salary.structure', 'hr.employee', 'hr_payroll/repo
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -9,7 +9,7 @@ import mx.DateTime
from mx.DateTime import RelativeDateTime, now, DateTime, localtime
class employees_salary_report(rml_parse.rml_parse):
def __init__(self, cr, uid, name, context):
super(employees_salary_report, self).__init__(cr, uid, name, context)
self.localcontext.update({
@ -25,7 +25,7 @@ class employees_salary_report(rml_parse.rml_parse):
'get_other':self.get_other,
'get_monthly_total':self.get_monthly_total,
})
self.mnths =[]
self.allow_list =[]
self.deduct_list = []
@ -34,17 +34,17 @@ class employees_salary_report(rml_parse.rml_parse):
self.curr_fiscal_year_name=''
self.period_ids = []
self.total=0.00
def get_periods(self,form):
self.mnths =[]
fiscalyear = pooler.get_pool(self.cr.dbname).get('account.fiscalyear')
curr_fiscalyear_id = form['fiscalyear_id']
curr_fiscalyear = fiscalyear.read(self.cr,self.uid,[form['fiscalyear_id']],['date_start','date_stop'])[0]
# Get start year-month-date and end year-month-date
fy = int(curr_fiscalyear['date_start'][0:4])
fy = int(curr_fiscalyear['date_start'][0:4])
ly = int(curr_fiscalyear['date_stop'][0:4])
fm = int(curr_fiscalyear['date_start'][5:7])
lm = int(curr_fiscalyear['date_stop'][5:7])
no_months = (ly-fy)*12+lm-fm + 1
@ -56,7 +56,7 @@ class employees_salary_report(rml_parse.rml_parse):
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))
self.mnths.append(str(cm)+'-'+str(cy))
if cm == 12:
cm = 0
cy = ly
@ -68,10 +68,10 @@ class employees_salary_report(rml_parse.rml_parse):
return fiscalyear_obj.read(self.cr,self.uid,[fiscalyear_id],['name'])[0]['name']
def get_employee(self,form):
result = []
periods = []
emp = pooler.get_pool(self.cr.dbname).get('hr.employee')
emp_ids = form['employee_ids'][0][2]
result = []
periods = []
emp = pooler.get_pool(self.cr.dbname).get('hr.employee')
emp_ids = form['employee_ids']
result = emp.browse(self.cr,self.uid, emp_ids)
fiscalyear_obj = pooler.get_pool(self.cr.dbname).get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear_id'])
period_ids_l = fiscalyear_obj.period_ids
@ -79,7 +79,7 @@ class employees_salary_report(rml_parse.rml_parse):
periods.append(period.id)
self.period_ids = ','.join(map(str, periods))
return result
def get_employee_detail(self,obj):
self.month_total_list =['Net Total (Allowances with Basic - Deductions)',0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00]
self.allow_list =[]
@ -88,7 +88,7 @@ class employees_salary_report(rml_parse.rml_parse):
allowance_cat_ids =[]
deduction_cat_ids = []
other_cat_ids =[]
self.total = 0.00
self.total = 0.00
payment_category = self.pool.get('hr.allounce.deduction.categoty')
payslip = self.pool.get('hr.payslip')
allowance_cat_ids = payment_category.search( self.cr, self.uid, [('type','=','allow')])
@ -140,7 +140,7 @@ class employees_salary_report(rml_parse.rml_parse):
if other_flag:
self.other_list.append(res)
return None
def cal_monthly_amt(self,emp_id,category):
tot = 0.0
cnt = 1
@ -208,7 +208,7 @@ class employees_salary_report(rml_parse.rml_parse):
if not res:
result.append(0.00)
res = {}
cnt = cnt + 1
cnt = cnt + 1
cnt = 1
result.append(tot)
tot = 0.0
@ -219,17 +219,17 @@ class employees_salary_report(rml_parse.rml_parse):
def get_deduct(self):
return self.deduct_list
def get_other(self):
return self.other_list
def get_total(self):
return self.total
def get_monthly_total(self):
return self.month_total_list
report_sxw.report_sxw('report.employees.salary', 'hr.payslip', 'hr_payroll/report/report_employees_detail.rml', parser=employees_salary_report)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -6,7 +6,7 @@ from tools import amount_to_text_en
class payroll_advice_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(payroll_advice_report, self).__init__(cr, uid, name, context)
self.total_amount = 0.00
self.total_bysal = 0.00
self.localcontext.update({
@ -25,17 +25,17 @@ class payroll_advice_report(report_sxw.rml_parse):
date = mx.DateTime.strptime(input_date, '%Y-%m-%d')
res['mname']= date.strftime('%B')+'-'+date.strftime('%Y')
return res
def convert(self,amount, cur):
amt_en = amount_to_text_en.amount_to_text(amount,'en',cur);
return amt_en
def get_bysal_total(self):
return self.total_bysal
def get_total(self):
return self.total_amount
def get_detail(self,line_ids):
result =[]
if line_ids:
@ -50,5 +50,8 @@ class payroll_advice_report(report_sxw.rml_parse):
self.total_bysal += l.bysal
result.append(res)
return result
report_sxw.report_sxw('report.payroll.advice', 'hr.payroll.advice', 'hr_payroll/report/report_payroll_advice.rml', parser=payroll_advice_report)
report_sxw.report_sxw('report.payroll.advice', 'hr.payroll.advice', 'hr_payroll/report/report_payroll_advice.rml', parser=payroll_advice_report)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -3,7 +3,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
@ -28,23 +28,23 @@ from report import report_sxw
from tools import amount_to_text_en
class payslip_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(payslip_report, self).__init__(cr, uid, name, context)
self.localcontext.update({
'convert' : self.convert,
'convert' : self.convert,
'get_month' : self.get_month,
'get_earnings': self.get_earnings,
'get_deductions':self.get_deductions,
'get_leave':self.get_leave,
'get_others':self.get_others,
})
def convert(self,amount, cur):
amt_en = amount_to_text_en.amount_to_text(amount,'en',cur)
return amt_en
def get_others(self,obj):
res = []
ids = []
@ -55,7 +55,7 @@ class payslip_report(report_sxw.rml_parse):
if len(ids):
res = payslip_line.browse(self.cr, self.uid, ids)
return res
def get_leave(self,obj):
res = []
ids = []
@ -66,7 +66,7 @@ class payslip_report(report_sxw.rml_parse):
if len(ids):
res = payslip_line.browse(self.cr, self.uid, ids)
return res
def get_earnings(self,obj):
res = []
ids = []
@ -97,14 +97,14 @@ class payslip_report(report_sxw.rml_parse):
res['mname']= date.strftime('%B')+"-"+date.strftime('%Y')
return res['mname']
report_sxw.report_sxw('report.payslip.pdf', 'hr.payslip', 'hr_payroll/report/payslip.rml', parser=payslip_report)
report_sxw.report_sxw('report.payslip.pdf', 'hr.payslip', 'hr_payroll/report/payslip.rml', parser=payslip_report)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -64,7 +64,7 @@ class year_salary_report(rml_parse.rml_parse):
periods = []
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'][0][2]
emp_ids = form['employee_ids']
empll = emp.browse(self.cr,self.uid, emp_ids)
fiscalyear_obj = pooler.get_pool(self.cr.dbname).get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear_id'])
period_ids_l = fiscalyear_obj.period_ids

View File

@ -1,3 +1,26 @@
import wizard_year_salary
import wizard_employees_detail
import wizard_create_analytic
#-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import hr_payroll_employees_detail
import hr_payroll_create_analytic
import hr_payroll_year_salary

View File

@ -1,63 +1,48 @@
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard
import pooler
import time
class wizard_create_analytics(wizard.interface):
'''
OpenERP Wizard
'''
form = '''<?xml version="1.0"?>
<form string="Process Form">
<field name="company_id"/>
<newline/>
<field name="type"/>
</form>'''
from osv import fields, osv
from tools.translate import _
fields = {
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company'},
'type': {'string':'Type', 'type':'selection', 'selection':[('bydeg','By Employee Function'), ('byallded','By Allownce / Deduction')]}
}
class hr_payroll_create_analytic(osv.osv_memory):
_name = "hr.payroll.create.analytic"
_columns = {
'company_id': fields.many2one('res.company', 'Company'),
'type': fields.selection([('bydeg','By Employee Function'), ('byallded','By Allownce / Deduction')],'Type'),
}
def _get_defaults(self, cr, user, data, context):
#TODO : initlize required data
return data['form']
def do_duplicate(self, cr, uid, ids, context=None):
account_pool =self.pool.get('account.analytic.account')
func_pool = self.pool.get('hr.employee.grade')
ad_pool = self.pool.get('hr.allounce.deduction.categoty')
data = self.read(cr,uid,ids)[0]
tpy = data['type']
company = data['company_id']
def _do_duplicate(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
account_pool = pool.get('account.analytic.account')
func_pool = pool.get('hr.employee.grade')
ad_pool = pool.get('hr.allounce.deduction.categoty')
tpy = data['form']['type']
company = data['form']['company_id']
function_ids = func_pool.search(cr, uid, [])
ad_ids = ad_pool.search(cr, uid, [])
if tpy == 'bydeg':
for function in func_pool.browse(cr, uid, function_ids):
res = {
@ -78,9 +63,9 @@ class wizard_create_analytics(wizard.interface):
'parent_id': fid
}
account_pool.create(cr, uid, res)
elif tpy == 'byallded':
res = {
'name':'Basic Salary',
@ -94,7 +79,7 @@ class wizard_create_analytics(wizard.interface):
'parent_id': adid
}
account_pool.create(cr, uid, res)
for ad in ad_pool.browse(cr, uid, ad_ids):
res = {
'name':ad.name,
@ -108,17 +93,8 @@ class wizard_create_analytics(wizard.interface):
'parent_id': adid
}
account_pool.create(cr, uid, res)
return {}
states = {
'init': {
'actions': [_get_defaults],
'result': {'type': 'form', 'arch': form, 'fields': fields, 'state': (('end', 'Cancel'), ('process', 'Process'))},
},
'process': {
'actions': [_do_duplicate],
'result': {'type': 'state', 'state': 'end'},
},
}
wizard_create_analytics('payroll.analysis')
hr_payroll_create_analytic()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_payroll_create_form" model="ir.ui.view">
<field name="name">Create Analytic</field>
<field name="model">hr.payroll.create.analytic</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Process Form">
<field name="company_id"/>
<field name="type"/>
<separator colspan="4"/>
<group col="2" colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="do_duplicate" string="Process" colspan="1" type="object" icon="gtk-yes"/>
</group>
</form>
</field>
</record>
<record id="action_view_hr_payroll_create" model="ir.actions.act_window">
<field name="name">Create Analytic Structure</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.payroll.create.analytic</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<!-- <menuitem id="menu_wizard_payroll_analysis"
action="action_view_hr_payroll_create"
parent="payroll_configure"
name="Create Analytic Structure" />-->
</data>
</openerp>

View File

@ -0,0 +1,68 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from osv import fields, osv
from tools.translate import _
class hr_payroll_employees_detail(osv.osv_memory):
_name ='hr.payroll.employees.detail'
_columns = {
'employee_ids': fields.many2many('hr.employee', 'payroll_emp_rel','payroll_id','emp_id', 'Employees',required=True),
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True)
}
def _get_fiscalyear(self, cr, uid, ids, context={}):
fiscal_ids=self.pool.get('account.fiscalyear').search(cr,uid,[])
if fiscal_ids:
return fiscal_ids[0]
return False
_defaults = {
'fiscalyear_id':_get_fiscalyear,
}
def print_report(self, cr, uid, ids, context=None):
"""
To get the date and print the report
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : return report
"""
datas = {'ids': context.get('active_ids', [])}
res = self.read(cr, uid, ids, ['employee_ids', 'fiscalyear_id'], context=context)
res = res and res[0] or {}
datas['form'] = res
return {
'type': 'ir.actions.report.xml',
'report_name': 'employees.salary',
'datas': datas,
'nodestroy':True,
}
hr_payroll_employees_detail()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_payroll_employees_detail" model="ir.ui.view">
<field name="name">Employee Salary Statement</field>
<field name="model">hr.payroll.employees.detail</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Year Salary">
<group col="4" colspan="4" width="600">
<group col="2" colspan="1">
<field name="fiscalyear_id" align="1.0" />
<newline/>
<separator string="Employees" colspan="4"/>
<field name="employee_ids" nolabel="1" colspan="2" />
</group>
<newline/>
<group col="2" colspan="1">
<button icon='gtk-cancel' special="cancel"
string="Close" />
<button name="print_report" string="Print Report"
type="object" icon="gtk-print" />
</group>
</group>
</form>
</field>
</record>
<record id="action_hr_payroll_employees_detail" model="ir.actions.act_window">
<field name="name">Employee Salary Statement</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.payroll.employees.detail</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem id="menu_hr_payroll_employees_detail"
icon="STOCK_PRINT"
action="action_hr_payroll_employees_detail"
parent="menu_hr_payroll_reporting"
name="Employee Salary Statement"/>
</data>
</openerp>

View File

@ -0,0 +1,70 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from osv import fields, osv
from tools.translate import _
class hr_payroll_year_salary(osv.osv_memory):
_name = "hr.payroll.year.salary"
_columns = {
'employee_ids': fields.many2many('hr.employee', 'payroll_year_rel','payroll_year_id','emp_id', 'Employees',required=True),
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True) ,
'salary_on': fields.selection([('current_month','Current Month Date'),('next_month','Next Month Date')],'Salary On'),
}
def _get_fiscalyear(self, cr, uid, ids, context=None):
fiscal_ids=self.pool.get('account.fiscalyear').search(cr,uid,[],context=context)
if fiscal_ids:
return fiscal_ids[0]
return False
_defaults = {
'fiscalyear_id':_get_fiscalyear,
'salary_on': 'current_month'
}
def print_report(self, cr, uid, ids, context=None):
"""
To get the date and print the report
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : return report
"""
datas = {'ids': context.get('active_ids', [])}
res = self.read(cr, uid, ids, ['employee_ids', 'fiscalyear_id','salary_on'], context=context)
res = res and res[0] or {}
datas['form'] = res
return {
'type': 'ir.actions.report.xml',
'report_name': 'year.salary',
'datas': datas,
'nodestroy':True,
}
hr_payroll_year_salary()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_payroll_year_salary" model="ir.ui.view">
<field name="name">Salary Register</field>
<field name="model">hr.payroll.year.salary</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Year Salary">
<group col="4" colspan="4" width="600">
<group col="3" colspan="1">
<field name="fiscalyear_id" select="1" colspan="2"/>
<newline/>
<separator string="Employees" colspan="4"/>
<field name="employee_ids" nolabel="1" colspan="2"/>
<newline/>
<separator string="Salary Deposit Date Option?" colspan="2"/>
<newline/>
<field name="salary_on"/>
</group>
<newline/>
<group>
<button icon='gtk-cancel' special="cancel"
string="Close" />
<button name="print_report" string="Print Report"
type="object" icon="gtk-print" />
</group>
</group>
</form>
</field>
</record>
<record id="action_hr_payroll_year_salary" model="ir.actions.act_window">
<field name="name">Salary Register</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.payroll.year.salary</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem id="menu_wizard_print_year_salary"
icon="STOCK_PRINT"
action="action_hr_payroll_year_salary"
parent="menu_hr_payroll_reporting"
name="Salary Register"
/>
</data>
</openerp>

View File

@ -1,60 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard
import datetime
import pooler
import time
import netsvc
form='''<?xml version="1.0"?>
<form string="Year Salary">
<field name="fiscalyear_id" select="1" colspan="2"/>
<newline/>
<field name="employee_ids" colspan="2"/>
<newline/>
</form>'''
fields = {
'fiscalyear_id':{'string': 'Fiscal Year', 'type': 'many2one', 'relation': 'account.fiscalyear', 'required': True },
'employee_ids':{'string':'Employees', 'type':'many2many','relation':'hr.employee','required':True},
}
class wizard_print(wizard.interface):
def _get_defaults(self, cr, uid, data, context={}):
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
data['form']['fiscalyear_id'] = fiscalyear_obj.find(cr, uid)
return data['form']
states={
'init':{
'actions':[_get_defaults],
'result':{'type':'form', 'arch':form, 'fields':fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
},
'report':{
'actions':[],
'result':{'type':'print', 'report':'employees.salary', 'state':'end'}
}
}
wizard_print('wizard.employees.detail')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,69 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard
import datetime
import pooler
import time
import netsvc
form='''<?xml version="1.0"?>
<form string="Year Salary">
<field name="fiscalyear_id" select="1" colspan="2"/>
<newline/>
<field name="employee_ids" colspan="2"/>
<newline/>
<separator string="Salary Deposit Date Option?" colspan="2"/>
<newline/>
<field name="salary_on"/>
</form>'''
fields = {
'fiscalyear_id':{'string': 'Fiscal Year', 'type': 'many2one', 'relation': 'account.fiscalyear', 'required': True },
'employee_ids':{'string':'Employees', 'type':'many2many','relation':'hr.employee','required':True},
'salary_on':{
'string':"Salary On",
'type':'selection',
'selection':[('current_month','Current Month Date'),('next_month','Next Month Date')],
'default': lambda *a:'current_month'
},
}
class wizard_print(wizard.interface):
def _get_defaults(self, cr, uid, data, context={}):
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
data['form']['fiscalyear_id'] = fiscalyear_obj.find(cr, uid)
return data['form']
states={
'init':{
'actions':[_get_defaults],
'result':{'type':'form', 'arch':form, 'fields':fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
},
'report':{
'actions':[],
'result':{'type':'print', 'report':'year.salary', 'state':'end'}
}
}
wizard_print('wizard.year.salary')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: