[IMP]: improvement in payroll, seprate objects for the heads ad company contribution
bzr revid: mga@tinyerp.com-20100609143822-4sv2r1skek77t8mw
This commit is contained in:
parent
573acb3614
commit
3f3b015306
|
@ -65,9 +65,9 @@ hr_passport()
|
|||
class hr_payroll_structure(osv.osv):
|
||||
"""
|
||||
Salary structure used to defined
|
||||
* Basic
|
||||
* Allowlance
|
||||
* Deductions
|
||||
- Basic
|
||||
- Allowlance
|
||||
- Deductions
|
||||
"""
|
||||
|
||||
_name = 'hr.payroll.structure'
|
||||
|
@ -127,9 +127,9 @@ class hr_contract(osv.osv):
|
|||
hr_contract()
|
||||
|
||||
class payroll_register(osv.osv):
|
||||
'''
|
||||
"""
|
||||
Payroll Register
|
||||
'''
|
||||
"""
|
||||
_name = 'hr.payroll.register'
|
||||
_description = 'Payroll Register'
|
||||
|
||||
|
@ -514,11 +514,14 @@ class contrib_register_line(osv.osv):
|
|||
contrib_register_line()
|
||||
|
||||
class payment_category(osv.osv):
|
||||
'''
|
||||
Open ERP Model
|
||||
'''
|
||||
"""
|
||||
Allowance, Deduction Heads
|
||||
House Rent Allowance, Medical Allowance, Food Allowance
|
||||
Professional Tax, Advance TDS, Providend Funds, etc
|
||||
"""
|
||||
|
||||
_name = 'hr.allounce.deduction.categoty'
|
||||
_description = 'Allowance Deduction Categoty'
|
||||
_description = 'Allowance Deduction Heads'
|
||||
|
||||
_columns = {
|
||||
'name':fields.char('Categoty Name', size=64, required=True, readonly=False),
|
||||
|
@ -529,13 +532,40 @@ class payment_category(osv.osv):
|
|||
('other','Others'),
|
||||
],'Type', select=True),
|
||||
'contribute_per':fields.float('Contribution', digits=(16, int(config['price_accuracy'])), help='Define Company contribution ratio 1.00=100% contribution, If Employee Contribute 5% then company will and here 0.50 defined then company will contribute 50% on employee 5% contribution'),
|
||||
'contribute':fields.boolean('Contribe by Company ?', help='Is company contribute on this deduction, like Provident Fund'),
|
||||
'include_in_salary':fields.boolean('Included in Salary ?', help='If company contribute on this deduction then should company contribution is also deducted from Employee Salary'),
|
||||
'gratuity':fields.boolean('Use for Gratuity ?', required=False),
|
||||
'line_ids':fields.one2many('hr.allounce.deduction.categoty.line', 'category_id', 'Calculations', required=False),
|
||||
'base':fields.char('Based on', size=64, required=True, readonly=False, help='This will use to computer the % fields values, in general its on basic, but You can use all heads code field in small letter as a variable name i.e. hra, ma, lta, etc...., also you can use, static varible basic'),
|
||||
'condition':fields.char('Condition', size=1024, required=True, readonly=False, help='Applied this head for calculation if condition is true'),
|
||||
'sequence': fields.integer('Sequence', required=True, help='Use to arrange calculation sequence'),
|
||||
'note': fields.text('Description'),
|
||||
'user_id':fields.char('User', size=64, required=False, readonly=False),
|
||||
'state':fields.char('Label', size=64, required=False, readonly=False),
|
||||
'company_id':fields.many2one('res.company', 'Company', required=False),
|
||||
}
|
||||
_defaults = {
|
||||
'condition': lambda *a: 'True',
|
||||
'base': lambda *a:'basic',
|
||||
'sequence': lambda *a:5,
|
||||
'company_id': lambda self, cr, uid, context: \
|
||||
self.pool.get('res.users').browse(cr, uid, uid,
|
||||
context=context).company_id.id,
|
||||
}
|
||||
payment_category()
|
||||
|
||||
class company_contribution(osv.osv):
|
||||
"""
|
||||
Company contribution
|
||||
Allows to configure company contribution for some taxes
|
||||
"""
|
||||
|
||||
_name = 'company.contribution'
|
||||
_description = "Company Contribution"
|
||||
|
||||
_columns = {
|
||||
'category_id':fields.many2one('hr.allounce.deduction.categoty', 'Heads', required=False),
|
||||
'name':fields.char('Name', size=256, required=True, readonly=False),
|
||||
'contribute':fields.boolean('Contribe by Company ?', help='Is company contribute on this deduction, like Provident Fund'),
|
||||
'include_in_salary':fields.boolean('Included in Salary ?', help='If company contribute on this deduction then should company contribution is also deducted from Employee Salary'),
|
||||
'gratuity':fields.boolean('Use for Gratuity ?', required=False),
|
||||
'line_ids':fields.one2many('company.contribution.line', 'contribution_id', 'Calculations', required=False),
|
||||
'register_id':fields.property(
|
||||
'hr.contibution.register',
|
||||
type='many2one',
|
||||
|
@ -546,12 +576,7 @@ class payment_category(osv.osv):
|
|||
help="Contribution register based on company",
|
||||
required=False
|
||||
),
|
||||
'note': fields.text('Description'),
|
||||
'user_id':fields.char('User', size=64, required=False, readonly=False),
|
||||
'state':fields.char('Label', size=64, required=False, readonly=False),
|
||||
'company_id':fields.many2one('res.company', 'Company', required=False),
|
||||
'amount_type':fields.selection([
|
||||
# ('per','Percentage (%)'),
|
||||
('fix','Fixed Amount'),
|
||||
('func','Function Calculation'),
|
||||
],'Amount Type', select=True),
|
||||
|
@ -565,11 +590,10 @@ class payment_category(osv.osv):
|
|||
help="Expanse account where company expanse will be encoded",
|
||||
required=False
|
||||
),
|
||||
'company_id':fields.many2one('res.company', 'Company', required=False),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'condition': lambda *a: 'True',
|
||||
'base': lambda *a:'basic',
|
||||
'sequence': lambda *a:5,
|
||||
'amount_type': lambda *a:'fix',
|
||||
'company_id': lambda self, cr, uid, context: \
|
||||
self.pool.get('res.users').browse(cr, uid, uid,
|
||||
|
@ -583,7 +607,7 @@ class payment_category(osv.osv):
|
|||
uid: user id of current executer
|
||||
"""
|
||||
|
||||
line_pool = self.pool.get('hr.allounce.deduction.categoty.line')
|
||||
line_pool = self.pool.get('company.contribution.line')
|
||||
res = 0
|
||||
ids = line_pool.search(cr, uid, [('category_id','=',id), ('to_val','>=',value),('from_val','<=',value)])
|
||||
if not ids:
|
||||
|
@ -593,19 +617,20 @@ class payment_category(osv.osv):
|
|||
else:
|
||||
res = line_pool.browse(cr, uid, ids)[0].value
|
||||
return res
|
||||
|
||||
payment_category()
|
||||
|
||||
company_contribution()
|
||||
|
||||
class payment_category_line(osv.osv):
|
||||
'''
|
||||
Allowance Deduction Categoty
|
||||
'''
|
||||
_name = 'hr.allounce.deduction.categoty.line'
|
||||
class company_contribution_line(osv.osv):
|
||||
"""
|
||||
Company contribution lines
|
||||
"""
|
||||
|
||||
_name = 'company.contribution.line'
|
||||
_description = 'Allowance Deduction Categoty'
|
||||
_order = 'sequence'
|
||||
|
||||
_columns = {
|
||||
'category_id':fields.many2one('hr.allounce.deduction.categoty', 'Category', required=False),
|
||||
'contribution_id':fields.many2one('company.contribution', 'Contribution', required=False),
|
||||
'name':fields.char('Name', size=64, required=False, readonly=False),
|
||||
'umo_id':fields.many2one('product.uom', 'Unite', required=False),
|
||||
'from_val': fields.float('From', digits=(16, int(config['price_accuracy']))),
|
||||
|
@ -616,7 +641,7 @@ class payment_category_line(osv.osv):
|
|||
'sequence':fields.integer('Sequence'),
|
||||
'value': fields.float('Value', digits=(16, int(config['price_accuracy']))),
|
||||
}
|
||||
payment_category_line()
|
||||
company_contribution_line()
|
||||
|
||||
class hr_holidays_status(osv.osv):
|
||||
_inherit = "hr.holidays.status"
|
||||
|
|
|
@ -243,133 +243,9 @@
|
|||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<menuitem action="hr_contract.action_hr_contract" id="hr_menu_contract" parent="payroll_configure" name="Contracts" sequence="4"/>
|
||||
<!-- End Contract View-->
|
||||
|
||||
<!--
|
||||
<record id="hr_hr_employee_view_form3" model="ir.ui.view">
|
||||
<field name="name">hr.hr.employee.view.form3</field>
|
||||
<field name="model">hr.employee</field>
|
||||
<field name="inherit_id" ref="hr_contract.hr_hr_employee_view_form2"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="contract_ids" position="replace">
|
||||
<field colspan="4" name="contract_ids" nolabel="1">
|
||||
<tree string="Contracts">
|
||||
<field name="name"/>
|
||||
<field name="function"/>
|
||||
<field name="date_start"/>
|
||||
<field name="date_end"/>
|
||||
<field name="working_hours_per_day"/>
|
||||
<field name="wage_type_id"/>
|
||||
<field name="wage"/>
|
||||
</tree>
|
||||
<form string="Contract">
|
||||
<separator colspan="4" string="Generalities"/>
|
||||
<field colspan="4" name="name" select="1"/>
|
||||
<newline/>
|
||||
<separator colspan="4" string="Contract Duration"/>
|
||||
<field name="function"/>
|
||||
<field name="working_hours_per_day"/>
|
||||
<field name="working_days_per_week"/>
|
||||
<newline/>
|
||||
<field name="date_start" select="1"/>
|
||||
<field name="date_end" select="1"/>
|
||||
<separator colspan="4" string="Salary"/>
|
||||
<field name="wage_type_id"/>
|
||||
<field name="wage"/>
|
||||
<separator colspan="4" string="Notes"/>
|
||||
<field colspan="4" name="notes" nolabel="1"/>
|
||||
<separator colspan="4" string="Passport and Visa"/>
|
||||
<field name="permit_no"/>
|
||||
<field name="passport_id"/>
|
||||
<field name="visa_no"/>
|
||||
<field name="visa_expire"/>
|
||||
</form>
|
||||
</field>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="hr_hr_employee_view_form4" model="ir.ui.view">
|
||||
<field name="name">hr.hr.employee.view.form4</field>
|
||||
<field name="model">hr.employee</field>
|
||||
<field name="inherit_id" ref="hr_hr_employee_view_form3"/>
|
||||
<field name="arch" type="xml">
|
||||
<page string="Miscelleanous" position="replace">
|
||||
<page string="Miscelleanous / Statutory" position="replace">
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="Miscelleanous"/>
|
||||
<field name="manager" select="1"/>
|
||||
<field name="medic_exam" select="1"/>
|
||||
<field name="audiens_num"/>
|
||||
<field name="place_of_birth"/>
|
||||
<field name="marital_status"/>
|
||||
<field name="children"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="Statutory Information"/>
|
||||
<field name="pan_no" select="1"/>
|
||||
<field name="esp_account" select="1"/>
|
||||
<field name="pf_account"/>
|
||||
<field name="pg_joining"/>
|
||||
<field name="esi_account"/>
|
||||
<field name="hospital_id"/>
|
||||
</group>
|
||||
<separator colspan="4" string="Special Allowance and Deductions for Employee"/>
|
||||
<field name="line_ids" nolabel="1" colspan="4">
|
||||
<tree string="Salary Structure" editable="bottom">
|
||||
<field name="sequence"/>
|
||||
<field name="analytic_account_id"/>
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="amount_type"/>
|
||||
<field name="amount" on_change="onchange_amount(amount, amount_type)"/>
|
||||
<field name="condition_id">
|
||||
<form string="Condition">
|
||||
<field name="name"/>
|
||||
<field name="date_start"/>
|
||||
<field name="date_end"/>
|
||||
<field name="state"/>
|
||||
</form>
|
||||
</field>
|
||||
<field name="type"/>
|
||||
<field name="category_id" on_change="onchange_category(category_id)"/>
|
||||
<field name="account_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</page>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="hr_hr_employee_view_form5" model="ir.ui.view">
|
||||
<field name="name">hr.hr.employee.view.form5</field>
|
||||
<field name="model">hr.employee</field>
|
||||
<field name="inherit_id" ref="hr_hr_employee_view_form4"/>
|
||||
<field name="arch" type="xml">
|
||||
<page string="Miscelleanous / Statutory" position="after">
|
||||
<page string="Accounting Information">
|
||||
<field name="property_bank_account"/>
|
||||
<field name="salary_account"/>
|
||||
<field name="employee_account"/>
|
||||
<field name="analytic_account"/>
|
||||
<field name="slip_ids" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
</page>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_employee_form5" model="ir.ui.view">
|
||||
<field name="name">hr.employee.form5</field>
|
||||
<field name="model">hr.employee</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="hr.view_employee_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="otherid" position="after">
|
||||
<field name="passport_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
-->
|
||||
<!--
|
||||
Holiday Status inheritancy
|
||||
-->
|
||||
|
@ -382,7 +258,7 @@
|
|||
<field name="color_name" position="after">
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="4" string="Payroll Accounting"/>
|
||||
<field name="company_id" select="2"/>
|
||||
<field name="company_id" widget="selection" select="2"/>
|
||||
<field name="code"/>
|
||||
<field name="analytic_account_id"/>
|
||||
<field name="account_id"/>
|
||||
|
@ -395,21 +271,22 @@
|
|||
</field>
|
||||
</field>
|
||||
</record>
|
||||
<!--
|
||||
Employee Expanse
|
||||
-->
|
||||
<record id="view_expenses_form" model="ir.ui.view">
|
||||
<field name="name">hr.expense.form</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="hr_expense.view_expenses_form"/>
|
||||
<field name="model">hr.expense.expense</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="ref" position="after">
|
||||
<field name="category_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Employee Expanse-->
|
||||
<!-- -->
|
||||
<!-- <record id="view_expenses_form" model="ir.ui.view">-->
|
||||
<!-- <field name="name">hr.expense.form</field>-->
|
||||
<!-- <field name="type">form</field>-->
|
||||
<!-- <field name="inherit_id" ref="hr_expense.view_expenses_form"/>-->
|
||||
<!-- <field name="model">hr.expense.expense</field>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <field name="ref" position="after">-->
|
||||
<!-- <field name="category_id"/>-->
|
||||
<!-- </field>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
<!-- -->
|
||||
|
||||
<record id="view_hr_payslip_line_tree" model="ir.ui.view">
|
||||
<field name="name">hr.payslip.line.tree</field>
|
||||
<field name="model">hr.payslip.line</field>
|
||||
|
@ -586,11 +463,8 @@
|
|||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="view_hr_payslip_tree"/>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_view_hr_payslip_form" id="menu_department_tree" parent="menu_hr_root_payroll"/>
|
||||
|
||||
|
||||
|
||||
<record id="view_hr_employee_grade_tree" model="ir.ui.view">
|
||||
<field name="name">hr.payroll.structure.tree</field>
|
||||
<field name="model">hr.payroll.structure</field>
|
||||
|
@ -631,7 +505,7 @@
|
|||
</record>
|
||||
|
||||
<record id="action_view_hr_employee_grade_form" model="ir.actions.act_window">
|
||||
<field name="name">Employee Functions</field>
|
||||
<field name="name">Salary Structure</field>
|
||||
<field name="res_model">hr.payroll.structure</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="view_hr_employee_grade_tree"/>
|
||||
|
@ -642,12 +516,13 @@
|
|||
parent="payroll_configure"
|
||||
/>
|
||||
|
||||
<!-- Payment Heads -->
|
||||
<record id="hr_allounce_deduction_categoty_form" model="ir.ui.view">
|
||||
<field name="name">hr.allounce.deduction.categoty.form</field>
|
||||
<field name="model">hr.allounce.deduction.categoty</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Allowance / Deduction Category">
|
||||
<form string="Allowance / Deduction Heads">
|
||||
<group col="6" colspan="6">
|
||||
<field name="name" select="1"/>
|
||||
<field name="code" select="1"/>
|
||||
|
@ -658,31 +533,9 @@
|
|||
<field name="condition"/>
|
||||
<field name="sequence"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="Contributions Configuration"/>
|
||||
<field name="contribute"/>
|
||||
<field name="amount_type" attrs="{'required': [('contribute','=',True)]}"/>
|
||||
<field name="contribute_per" attrs="{'required': [('contribute','=',True)], 'readonly':[(('amount_type','=','func'))]}"/>
|
||||
<field name="register_id" attrs="{'required': [('contribute','=',True)]}"/>
|
||||
<field name="include_in_salary" />
|
||||
<field name="account_id" attrs="{'required': [('contribute','=',True), ('include_in_salary','=',True)]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Function" attrs="{'invisible': [('amount_type','!=','func')]}">
|
||||
<field name="line_ids" colspan="4" nolabel="1">
|
||||
<tree string="Function Arguments" editable="bottom">
|
||||
<field name="name"/>
|
||||
<field name="sequence"/>
|
||||
<field name="from_val"/>
|
||||
<field name="to_val"/>
|
||||
<field name="amount_type"/>
|
||||
<field name="value"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="Description">
|
||||
<separator colspan="4" string="Description"/>
|
||||
<field name="note" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
|
|
Loading…
Reference in New Issue