[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

@ -24,3 +24,5 @@
import hr_payroll
import report
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -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:

View File

@ -1871,3 +1871,4 @@ class hr_employee(osv.osv):
}
hr_employee()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

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

@ -92,7 +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

@ -71,7 +71,7 @@ class employees_salary_report(rml_parse.rml_parse):
result = []
periods = []
emp = pooler.get_pool(self.cr.dbname).get('hr.employee')
emp_ids = form['employee_ids'][0][2]
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
@ -231,5 +231,5 @@ class employees_salary_report(rml_parse.rml_parse):
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

@ -52,3 +52,6 @@ class payroll_advice_report(report_sxw.rml_parse):
return result
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

@ -104,7 +104,7 @@ report_sxw.report_sxw('report.payslip.pdf', 'hr.payslip', 'hr_payroll/report/pay
# 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,59 +1,44 @@
#!/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$
# 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
def do_duplicate(self, cr, uid, ids, context=None):
return data['form']
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']
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']
function_ids = func_pool.search(cr, uid, [])
ad_ids = ad_pool.search(cr, uid, [])
@ -110,15 +95,6 @@ class wizard_create_analytics(wizard.interface):
account_pool.create(cr, uid, res)
return {}
hr_payroll_create_analytic()
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')
# 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: