[MERGE] merged with aos branch 2

bzr revid: qdp-launchpad@openerp.com-20110411131346-nyi057yblbpu2jo3
This commit is contained in:
Quentin (OpenERP)
2011-04-11 15:13:46 +02:00
26 changed files with 1710 additions and 1567 deletions
+1 -11
View File
@@ -66,16 +66,6 @@ class hr_employee_category(osv.osv):
hr_employee_category()
class hr_employee_marital_status(osv.osv):
_name = "hr.employee.marital.status"
_description = "Employee Marital Status"
_columns = {
'name': fields.char('Marital Status', size=32, required=True, translate=True),
'description': fields.text('Status Description'),
}
hr_employee_marital_status()
class hr_job(osv.osv):
def _no_of_employee(self, cr, uid, ids, name, args, context=None):
@@ -141,7 +131,7 @@ class hr_employee(osv.osv):
'identification_id': fields.char('Identification No', size=32),
'otherid': fields.char('Other Id', size=64),
'gender': fields.selection([('male', 'Male'),('female', 'Female')], 'Gender'),
'marital': fields.many2one('hr.employee.marital.status', 'Marital Status'),
'marital': fields.selection([('single', 'Single'), ('married', 'Married'), ('widower', 'Widower'), ('divorced', 'Divorced')], 'Marital Status'),
'department_id':fields.many2one('hr.department', 'Department'),
'address_id': fields.many2one('res.partner.address', 'Working Address'),
'address_home_id': fields.many2one('res.partner.address', 'Home Address'),
-14
View File
@@ -2,20 +2,6 @@
<openerp>
<data noupdate="1">
<!-- Employee Marital Statusses -->
<record id="hr_employee_marital_status_single" model="hr.employee.marital.status">
<field name="name">Single</field>
</record>
<record id="hr_employee_marital_status_married" model="hr.employee.marital.status">
<field name="name">Married</field>
</record>
<record id="hr_employee_marital_status_divorced" model="hr.employee.marital.status">
<field name="name">Divorced</field>
</record>
<record id="hr_employee_marital_status_widower" model="hr.employee.marital.status">
<field name="name">Widower</field>
</record>
<record id="employee" model="hr.employee">
<field name="name">Administrator</field>
<field name="user_id" ref="base.user_root"/>
+1 -42
View File
@@ -48,7 +48,7 @@
<group col="2" colspan="2" groups="base.group_hr_user">
<separator string="Status" colspan="2"/>
<field name="gender"/>
<field name="marital" widget="selection"/>
<field name="marital"/>
<field name="country_id"/>
<field name="birthday"/>
</group>
@@ -164,47 +164,6 @@
<field name="res_id" ref="hr.menu_open_view_employee_list_my"/>
</record>
<!--
=======================
Employee marital status
=======================
-->
<record id="hr_hr_employee_marital_status_tree" model="ir.ui.view">
<field name="name">hr.hr.employee.marital.status.tree</field>
<field name="model">hr.employee.marital.status</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Marital Status">
<field name="name" />
</tree>
</field>
</record>
<record id="hr_hr_employee_marital_status_form" model="ir.ui.view">
<field name="name">hr.hr.employee.marital.status</field>
<field name="model">hr.employee.marital.status</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Marital Status">
<field name="name"/>
<separator colspan="4" string="Description"/>
<field colspan="4" name="description" nolabel="1"/>
</form>
</field>
</record>
<record id="action_hr_marital_status" model="ir.actions.act_window">
<field name="name">Marital Status</field>
<field name="res_model">hr.employee.marital.status</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="hr_hr_employee_marital_status_tree"/>
</record>
<menuitem action="action_hr_marital_status" id="hr_menu_marital_status"
parent="hr.menu_view_employee_category_configuration_form" sequence="3" groups="base.group_extended"/>
<!--
=======================
Employee architecture
-1
View File
@@ -8,5 +8,4 @@
"access_hr_department_employee","hr.department.employee","model_hr_department","base.group_user",1,0,0,0
"access_hr_job_user","hr.job user","model_hr_job","base.group_hr_user",1,1,1,1
"access_hr_res_partner_address","res.partner.address","base.model_res_partner_address","base.group_hr_manager",1,1,1,1
"access_hr_employee_marital_status_manager","hr.employee.marital.status.manager","model_hr_employee_marital_status","base.group_hr_manager",1,1,1,1
"access_ir_property_hr_user","ir_property hr_user","base.model_ir_property","base.group_hr_user",1,1,1,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
8 access_hr_department_employee hr.department.employee model_hr_department base.group_user 1 0 0 0
9 access_hr_job_user hr.job user model_hr_job base.group_hr_user 1 1 1 1
10 access_hr_res_partner_address res.partner.address base.model_res_partner_address base.group_hr_manager 1 1 1 1
access_hr_employee_marital_status_manager hr.employee.marital.status.manager model_hr_employee_marital_status base.group_hr_manager 1 1 1 1
11 access_ir_property_hr_user ir_property hr_user base.model_ir_property base.group_hr_user 1 1 1 0
+1 -1
View File
@@ -13,7 +13,7 @@
address_home_id: base.res_partner_address_1
company_id: base.main_company
gender: male
marital: hr.hr_employee_marital_status_single
marital: 'single'
name: Mark Johnson
user_id: base.user_root
department_id: 'hr_department_rd0'
+1 -1
View File
@@ -11,7 +11,7 @@
name: Mark Johnson
user_id: base.user_root
children: 2
marital: hr.hr_employee_marital_status_married
marital: 'married'
place_of_birth: Belgium
vehicle: 'No'
vehicle_distance: 12
+92 -27
View File
@@ -68,10 +68,12 @@ class hr_payroll_structure(osv.osv):
@return: returns a id of newly created record
"""
default = {
if not default:
default = {}
default.update({
'code': self.browse(cr, uid, id, context=context).code + "(copy)",
'company_id': self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
}
})
return super(hr_payroll_structure, self).copy(cr, uid, id, default, context=context)
def get_all_rules(self, cr, uid, structure_ids, context=None):
@@ -79,16 +81,10 @@ class hr_payroll_structure(osv.osv):
@param structure_ids: list of structure
@return: returns a list of tuple (id, sequence) of rules that are maybe to apply
"""
def recursive_search_of_rule(rule_ids):
children_rules = []
for rule in rule_ids:
if rule.child_ids:
children_rules += recursive_search_of_rule(rule.child_ids)
return [(r.id, r.sequence) for r in rule_ids] + children_rules
all_rules = []
for struct in self.browse(cr, uid, structure_ids, context=context):
all_rules += recursive_search_of_rule(struct.rule_ids)
all_rules += self.pool.get('hr.salary.rule')._recursive_search_of_rules(cr, uid, struct.rule_ids, context=context)
return all_rules
def _get_parent_structure(self, cr, uid, struct_ids, context=None):
@@ -113,7 +109,7 @@ class hr_contract(osv.osv):
_inherit = 'hr.contract'
_description = 'Employee Contract'
_columns = {
'struct_id': fields.many2one('hr.payroll.structure', 'Salary Structure'),
'struct_id': fields.many2one('hr.payroll.structure', 'Salary Structure', required=True),
'schedule_pay': fields.selection([
('monthly', 'Monthly'),
('quarterly', 'Quarterly'),
@@ -250,6 +246,7 @@ class hr_payslip(osv.osv):
'paid': fields.boolean('Made Payment Order ? ', required=False, readonly=True, states={'draft': [('readonly', False)]}),
'note': fields.text('Description'),
'contract_id': fields.many2one('hr.contract', 'Contract', required=False, readonly=True, states={'draft': [('readonly', False)]}),
'credit_note': fields.boolean('Credit Note', help="Indicates this payslip has a refund of another"),
#TODO put me back
# 'details_by_salary_head': fields.function(_get_salary_rules, method=True, type='one2many', relation='hr.salary.rule', string='Details by Salary Head', multi='details_by_salary_head'),
}
@@ -257,28 +254,27 @@ class hr_payslip(osv.osv):
'date_from': lambda *a: time.strftime('%Y-%m-01'),
'date_to': lambda *a: str(datetime.now() + relativedelta.relativedelta(months=+1, day=1, days=-1))[:10],
'state': 'draft',
'credit_note': False,
'company_id': lambda self, cr, uid, context: \
self.pool.get('res.users').browse(cr, uid, uid,
context=context).company_id.id,
}
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
default = {
default.update({
'line_ids': [],
'move_ids': [],
'move_line_ids': [],
'move_payment_ids': [],
'company_id': company_id,
'period_id': False,
'basic_before_leaves': 0.0,
'basic_amount': 0.0
}
})
return super(hr_payslip, self).copy(cr, uid, id, default, context=context)
def set_to_draft(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state': 'draft'}, context=context)
def cancel_sheet(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
@@ -291,6 +287,34 @@ class hr_payslip(osv.osv):
def process_sheet(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'paid': True, 'state': 'done'}, context=context)
def refund_sheet(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
wf_service = netsvc.LocalService("workflow")
for id in ids:
id_copy = self.copy(cr, uid, id, {'credit_note': True}, context=context)
self.compute_sheet(cr, uid, [id_copy], context=context)
wf_service.trg_validate(uid, 'hr.payslip', id_copy, 'verify_sheet', cr)
wf_service.trg_validate(uid, 'hr.payslip', id_copy, 'final_verify_sheet', cr)
wf_service.trg_validate(uid, 'hr.payslip', id_copy, 'process_sheet', cr)
form_id = mod_obj.get_object_reference(cr, uid, 'hr_payroll', 'view_hr_payslip_form')
form_res = form_id and form_id[1] or False
tree_id = mod_obj.get_object_reference(cr, uid, 'hr_payroll', 'view_hr_payslip_tree')
tree_res = tree_id and tree_id[1] or False
return {
'name':_("Refund Payslip"),
'view_mode': 'tree, form',
'view_id': False,
'view_type': 'form',
'res_model': 'hr.payslip',
'type': 'ir.actions.act_window',
'nodestroy': True,
'target': 'current',
'domain': "[('id', 'in', %s)]" % [id_copy],
'views': [(tree_res, 'tree'), (form_res, 'form')],
'context': {}
}
def verify_sheet(self, cr, uid, ids, context=None):
#TODO clean me: this function should create the register lines accordingly to the rules computed (run the compute_sheet first)
# holiday_pool = self.pool.get('hr.holidays')
@@ -443,29 +467,40 @@ class hr_payslip(osv.osv):
return res
def get_payslip_lines(self, cr, uid, contract_ids, payslip_id, context):
def _sum_salary_head(localdict, head, amount):
if head.parent_id:
localdict = _sum_salary_head(localdict, head.parent_id, amount)
localdict['heads'][head.code] = head.code in localdict['heads'] and localdict['heads'][head.code] + amount or amount
return localdict
result = []
blacklist = []
payslip = self.pool.get('hr.payslip').browse(cr, uid, payslip_id, context=context)
localdict = {'rules': {}, 'heads': {}, 'payslip': payslip}
worked_days = {}
for input_line in payslip.input_line_ids:
worked_days[input_line.code] = input_line
localdict = {'rules': {}, 'heads': {}, 'payslip': payslip, 'worked_days': worked_days}
#get the ids of the structures on the contracts and their parent id as well
structure_ids = self.pool.get('hr.contract').get_all_structures(cr, uid, contract_ids, context=context)
#get the rules of the structure and thier children
rule_ids = self.pool.get('hr.payroll.structure').get_all_rules(cr, uid, structure_ids, context=context)
#run the rules by sequence
#import pdb;pdb.set_trace()
sorted_rule_ids = [id for id, sequence in sorted(rule_ids, key=lambda x:x[1])]
for contract in self.pool.get('hr.contract').browse(cr, uid, contract_ids, context=context):
employee = contract.employee_id
localdict.update({'employee': employee, 'contract': contract})
for rule in self.pool.get('hr.salary.rule').browse(cr, uid, sorted_rule_ids, context=context):
localdict['result'] = None
#check if the rule can be applied
if self.pool.get('hr.salary.rule').satisfy_condition(cr, uid, rule.id, localdict, context=context):
if self.pool.get('hr.salary.rule').satisfy_condition(cr, uid, rule.id, localdict, context=context) and rule.id not in blacklist:
amount = self.pool.get('hr.salary.rule').compute_rule(cr, uid, rule.id, localdict, context=context)
#set/overwrite the amount computed for this rule in the localdict
localdict['rules'][rule.code] = amount
#sum the amount for its salary head
localdict['heads'][rule.category_id.code] = rule.category_id.code in localdict['heads'] and localdict['heads'][rule.category_id.code] + amount or amount
localdict = _sum_salary_head(localdict, rule.category_id, amount)
vals = {
'salary_rule_id': rule.id,
'name': rule.name,
'code': rule.code,
'category_id': rule.category_id.id,
@@ -486,6 +521,9 @@ class hr_payslip(osv.osv):
'employee_id': contract.employee_id.id,
}
result.append(vals)
else:
#blacklist this rule and its children
blacklist += [id for id, seq in self.pool.get('hr.salary.rule')._recursive_search_of_rules(cr, uid, [rule], context=context)]
return result
def onchange_employee_id(self, cr, uid, ids, date_from, date_to, employee_id=False, contract_id=False, context=None):
@@ -630,6 +668,7 @@ class hr_salary_rule(osv.osv):
# contract: hr.contract object
# rules: dictionary containing the previsouly computed rules. Keys are the rule codes.
# heads: dictionary containing the computed heads (sum of amount of all rules belonging to that head). Keys are the head codes.
# worked_days: dictionary containing the computed worked days. Keys are the worked days codes.
# Note: returned value have to be set in the variable 'result'
@@ -643,6 +682,7 @@ result = contract.wage * 0.10''',
# contract: hr.contract object
# rules: dictionary containing the previsouly computed rules. Keys are the rule codes.
# heads: dictionary containing the computed heads (sum of amount of all rules belonging to that head). Keys are the head codes.
# worked_days: dictionary containing the computed worked days. Keys are the worked days codes.
# Note: returned value have to be set in the variable 'result'
@@ -660,6 +700,17 @@ result = rules['NET'] > heads['NET'] * 0.10''',
'amount_percentage': 0.0,
}
def _recursive_search_of_rules(self, cr, uid, rule_ids, context=None):
"""
@param rule_ids: list of browse record
@return: returns a list of tuple (id, sequence) which are all the children of the passed rule_ids
"""
children_rules = []
for rule in rule_ids:
if rule.child_ids:
children_rules += self._recursive_search_of_rules(cr, uid, rule.child_ids, context=context)
return [(r.id, r.sequence) for r in rule_ids] + children_rules
#TODO should add some checks on the type of result (should be float)
def compute_rule(self, cr, uid, rule_id, localdict, context=None):
"""
@@ -671,10 +722,16 @@ result = rules['NET'] > heads['NET'] * 0.10''',
if rule.amount_select == 'fix':
return rule.amount_fix
elif rule.amount_select == 'percentage':
return rule.amount_percentage * eval(rule.amount_percentage_base, localdict) / 100
try:
return rule.amount_percentage * eval(rule.amount_percentage_base, localdict) / 100
except:
raise osv.except_osv(_('Error'), _('Wrong percentage base defined for salary rule %s (%s)')% (rule.name, rule.code))
else:
eval(rule.amount_python_compute, localdict, mode='exec', nocopy=True)
return localdict['result']
try:
eval(rule.amount_python_compute, localdict, mode='exec', nocopy=True)
return localdict['result']
except:
raise osv.except_osv(_('Error'), _('Wrong python code defined for salary rule %s (%s) ')% (rule.name, rule.code))
def satisfy_condition(self, cr, uid, rule_id, localdict, context=None):
"""
@@ -687,11 +744,18 @@ result = rules['NET'] > heads['NET'] * 0.10''',
if rule.condition_select == 'none':
return True
elif rule.condition_select == 'range':
result = eval(rule.condition_range, localdict)
return rule.condition_range_min <= result and result <= rule.condition_range_max or False
try:
result = eval(rule.condition_range, localdict)
return rule.condition_range_min <= result and result <= rule.condition_range_max or False
except:
raise osv.except_osv(_('Error'), _('Wrong range condition defined for salary rule %s (%s)')% (rule.name, rule.code))
else: #python code
eval(rule.condition_python, localdict, mode='exec', nocopy=True)
return 'result' in localdict and localdict['result'] or False
try:
eval(rule.condition_python, localdict, mode='exec', nocopy=True)
return 'result' in localdict and localdict['result'] or False
except:
raise osv.except_osv(_('Error'), _('Wrong python condition defined for salary rule %s (%s)')% (rule.name, rule.code))
hr_salary_rule()
class hr_payslip_line(osv.osv):
@@ -706,6 +770,7 @@ class hr_payslip_line(osv.osv):
_columns = {
'slip_id':fields.many2one('hr.payslip', 'Pay Slip', required=True),
'salary_rule_id':fields.many2one('hr.salary.rule', 'Rule', required=True),
'employee_id':fields.many2one('hr.employee', 'Employee', required=True),
'total': fields.float('Amount', digits_compute=dp.get_precision('Account')),
'company_contrib': fields.float('Company Contribution', readonly=True, digits_compute=dp.get_precision('Account')),
+57 -2
View File
@@ -2,7 +2,12 @@
<openerp>
<data noupdate="1">
<record id="AL" model="hr.salary.head">
<record id="BASIC" model="hr.salary.head">
<field name="name">Basic</field>
<field name="code">BASIC</field>
</record>
<record id="ALW" model="hr.salary.head">
<field name="name">Allowance</field>
<field name="code">ALW</field>
</record>
@@ -12,7 +17,17 @@
<field name="code">DED</field>
</record>
<record id="HRA" model="hr.salary.head">
<record id="GROSS" model="hr.salary.head">
<field name="name">Gross</field>
<field name="code">GROSS</field>
</record>
<record id="NET" model="hr.salary.head">
<field name="name">Net</field>
<field name="code">NET</field>
</record>
<!-- <record id="HRA" model="hr.salary.head">
<field name="code">HRA</field>
<field name="parent_id" ref="AL"/>
<field name="name">House Rent Allowance</field>
@@ -139,6 +154,46 @@
<field name="sequence" eval="500"/>
<field name="python_compute">total = basic+allowance+deduction</field>
</record>
-->
<record id="hr_rule_basic" model="hr.salary.rule">
<field name="name">Basic</field>
<field name="sequence" eval="1"/>
<field name="code">BASIC</field>
<field name="category_id" ref="hr_payroll.BASIC"/>
<field name="condition_select">none</field>
<field name="amount_select">code</field>
<field name="amount_python_compute">result = contract.wage</field>
</record>
<record id="hr_rule_taxable" model="hr.salary.rule">
<field name="name">Gross</field>
<field name="sequence" eval="100"/>
<field name="code">GROSS</field>
<field name="category_id" ref="hr_payroll.GROSS"/>
<field name="condition_select">none</field>
<field name="amount_select">code</field>
<field name="amount_python_compute">result = heads['BASIC'] + ('ALW' in heads and heads['ALW'] or 0.0)</field>
</record>
<record id="hr_rule_net" model="hr.salary.rule">
<field name="name">Net</field>
<field name="sequence" eval="200"/>
<field name="code">NET</field>
<field name="category_id" ref="hr_payroll.NET"/>
<field name="condition_select">none</field>
<field name="amount_select">code</field>
<field name="amount_python_compute">result = heads['BASIC'] + ('ALW' in heads and heads['ALW'] or 0.0) + ('DED' in heads and heads['DED'] or 0.0)</field>
</record>
<!-- Salary Structure -->
<record id="structure_base" model="hr.payroll.structure">
<field name="code">BASE</field>
<field name="name">Base for new structures</field>
<field eval="[(6, 0, [ref('hr_rule_basic'), ref('hr_rule_taxable'),ref('hr_rule_net')])]" name="rule_ids"/>
<field name="company_id" ref="base.main_company"/>
</record>
</data>
</openerp>
+8 -11
View File
@@ -9,8 +9,7 @@
<field eval="40.0" name="amount_percentage"/>
<field name="amount_percentage_base">contract.wage</field>
<field name="code">HRA</field>
<field name="type" ref="AL"/>
<field name="category_id" ref="hr_payroll.HRA"/>
<field name="category_id" ref="hr_payroll.ALW"/>
<field name="name">House Rent Allowance</field>
<field name="sequence" eval="5"/>
</record>
@@ -19,30 +18,27 @@
<field name="amount_select">fix</field>
<field eval="800.0" name="amount_fix"/>
<field name="code">CA</field>
<field name="type" ref="AL"/>
<field name="category_id" ref="hr_payroll.CA"/>
<field name="category_id" ref="hr_payroll.ALW"/>
<field name="name">Conveyance Allowance</field>
<field name="sequence" eval="10"/>
</record>
<record id="hr_payslip_line_professionaltax1" model="hr.salary.rule">
<field name="amount_select">fix</field>
<field eval="15" name="sequence"/>
<field eval="150" name="sequence"/>
<field eval="-200.0" name="amount_fix"/>
<field name="code">PT</field>
<field name="type" ref="DED"/>
<field name="category_id" ref="hr_payroll.PT"/>
<field name="category_id" ref="hr_payroll.DED"/>
<field name="name">Professional Tax</field>
</record>
<record id="hr_payslip_line_providentfund1" model="hr.salary.rule">
<field name="amount_select">percentage</field>
<field eval="20" name="sequence"/>
<field eval="120" name="sequence"/>
<field eval="-12.5" name="amount_percentage"/>
<field name="amount_percentage_base">contract.wage</field>
<field name="code">PF</field>
<field name="type" ref="DED"/>
<field name="category_id" ref="hr_payroll.PF"/>
<field name="category_id" ref="hr_payroll.DED"/>
<field name="name">Provident Fund</field>
</record>
@@ -53,6 +49,7 @@
<field name="name">Marketing Executive</field>
<field eval="[(6, 0, [ref('hr_payslip_line_houserantallowance1'), ref('hr_payslip_line_convanceallowance1'),ref('hr_payslip_line_professionaltax1'),ref('hr_payslip_line_providentfund1')])]" name="rule_ids"/>
<field name="company_id" ref="base.main_company"/>
<field name="parent_id" ref="structure_base"/>
</record>
<!-- Employee -->
@@ -67,7 +64,7 @@
<!-- Employee Contract -->
<record id="hr_contract_firstcontract1" model="hr.contract">
<field name="name">First Contract</field>
<field name="name">Marketing Executive Contract</field>
<field name="type_id" ref="hr_contract.hr_contract_type_emp"/>
<field name="date_start" eval="time.strftime('%Y-%m')+'-1'"/>
<field name="date_end" eval="time.strftime('%Y')+'-12-31'"/>
+20 -10
View File
@@ -85,7 +85,15 @@
</group>
<notebook colspan="4">
<page string="Salary Rules">
<field colspan="4" name="rule_ids" nolabel="1" />
<field colspan="4" name="rule_ids" nolabel="1" domain="[('parent_rule_id','=',False)]">
<tree>
<field name="name"/>
<field name="code"/>
<field name="category_id"/>
<field name="sequence" groups="base.group_extended" invisible="1"/>
<field name="register_id"/>
</tree>
</field>
</page>
</notebook>
</form>
@@ -188,10 +196,11 @@
<field name="struct_id" groups="base.group_extended" attrs="{'required':[('contract_id','&lt;&gt;',False)]}"/>
<field name="date_to"/>
<field name="name" colspan="4"/>
<field name="credit_note" readonly="1"/>
</group>
<notebook colspan="4">
<page string="Salary Computation" >
<field name="line_ids" colspan="4" nolabel="1">
<field name="line_ids" colspan="4" nolabel="1" domain="[('appears_on_payslip','&lt;&gt;',False)]">
<tree string="Salary Structure" editable="bottom">
<field name="name"/>
<field name="code"/>
@@ -203,6 +212,8 @@
<group col="6" colspan="4">
<field name="name" colspan="4" select="1"/>
<field name="code" select="1"/>
<field name="appears_on_payslip"/>
<field name="salary_rule_id"/>
</group>
<group col="2" colspan="2">
<separator colspan="4" string="Calculations"/>
@@ -270,7 +281,8 @@
<button string="Verify Sheet" icon="terp-camera_test" name="verify_sheet" states="draft"/>
<button string="Approve Sheet" icon="terp-camera_test" name="final_verify_sheet" states="hr_check"/>
<button string="Pay Salary" icon="terp-dolar_ok!" name="process_sheet" states="confirm"/>
<button string="Set to Draft" icon="terp-stock_effects-object-colorize" name="set_to_draft" states="cancel"/>
<button string="Set to Draft" icon="terp-stock_effects-object-colorize" name="draft" states="cancel"/>
<button string="Refund" icon="gtk-execute" name="refund_sheet" states="confirm,done" type='object'/>
</group>
</form>
</field>
@@ -421,7 +433,7 @@
parent="payroll_configure"
sequence="14"
/>
<record id="hr_contibution_register_line_form" model="ir.ui.view">
<!-- <record id="hr_contibution_register_line_form" model="ir.ui.view">
<field name="name">hr.contibution.register.line.form</field>
<field name="model">hr.contibution.register.line</field>
<field name="type">form</field>
@@ -435,7 +447,7 @@
<field name="total"/>
</form>
</field>
</record>
</record> -->
@@ -457,13 +469,11 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Salary Rules">
<field name="category_id"/>
<field name="sequence" groups="base.group_extended"/>
<field name="name"/>
<field name="code"/>
<field name="amount_select"/>
<field name="condition_range_min"/>
<field name="condition_range_max"/>
<field name="category_id"/>
<field name="sequence" groups="base.group_extended" invisible="1"/>
<field name="register_id"/>
</tree>
</field>
</record>
+4 -2
View File
@@ -11,8 +11,10 @@
<field name="wkf_id" ref="wkf"/>
<field name="name">draft</field>
<field name="flow_start">True</field>
<field name="kind">function</field>
<field name="action">write({'state': 'draft'})</field>
<field name="split_mode">OR</field>
<field name="kind">dummy</field>
</record>
<record id="act_hr_check" model="workflow.activity">
@@ -89,7 +91,7 @@
<record id="t12" model="workflow.transition">
<field name="act_from" ref="act_cancel"/>
<field name="act_to" ref="act_draft"/>
<field name="signal">set_to_draft</field>
<field name="signal">draft</field>
</record>
</data>
</openerp>
@@ -1,7 +1,6 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_hr_payroll_structure","hr.payroll.structure","model_hr_payroll_structure","base.group_hr_user",1,1,1,1
"access_hr_contibution_register","hr.contibution.register","model_hr_contibution_register","base.group_hr_user",1,1,1,1
"access_hr_contibution_register_line","hr.contibution.register.line","model_hr_contibution_register_line","base.group_hr_user",1,1,1,1
"access_hr_salary_head","hr.salary.head","model_hr_salary_head","base.group_hr_user",1,1,1,1
"access_hr_payslip","hr.payslip","model_hr_payslip","base.group_hr_user",1,1,1,1
"access_hr_payslip_line","hr.payslip.line","model_hr_payslip_line","base.group_hr_user",1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_hr_payroll_structure hr.payroll.structure model_hr_payroll_structure base.group_hr_user 1 1 1 1
3 access_hr_contibution_register hr.contibution.register model_hr_contibution_register base.group_hr_user 1 1 1 1
access_hr_contibution_register_line hr.contibution.register.line model_hr_contibution_register_line base.group_hr_user 1 1 1 1
4 access_hr_salary_head hr.salary.head model_hr_salary_head base.group_hr_user 1 1 1 1
5 access_hr_payslip hr.payslip model_hr_payslip base.group_hr_user 1 1 1 1
6 access_hr_payslip_line hr.payslip.line model_hr_payslip_line base.group_hr_user 1 1 1 1
@@ -18,6 +18,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import hr_payroll_rule
import hr_payroll_l10n_be
import hr_contract
import hr_payroll
@@ -19,20 +19,36 @@
#
##############################################################################
{
'name': 'hr_payroll_salary_rule',
'name': 'hr_payroll_l10n_be',
'category': 'payroll',
'init_xml':[],
'author': 'AOS',
'depends': ['hr_payroll','hr_contract'],
'version': '1.0',
'description': """
Belgian Payroll system.
=======================
* Employee Details
* Employee Contracts
* Passport based Contract
* Allowances / Deductions
* Allow to configure Basic / Grows / Net Salary
* Employee Payslip
* Monthly Payroll Register
* Integrated with Holiday Management
* Salary Maj, ONSS, Precompte Professionnel, Child Allowance, ...
""",
'active': False,
'demo_xml': [],
'update_xml':[
# 'res.users.csv',
# 'security/hr.salary.rule.csv',
'hr_payroll_rule_view.xml',
'hr_payroll_rule_data.xml',
'data/hr.salary.rule.csv',
'hr_payroll_l10n_be_view.xml',
'hr_payroll_l10n_be_data.xml',
'data/hr.salary.rule.csv',
],
'installable': True
}
@@ -40,7 +40,8 @@ class hr_contract_be(osv.osv):
_columns = {
'reim_travel':fields.float('Reimbursement of travel expenses', digits=(16,2)),
'company_car':fields.float('Company car Deduction', digits=(16,2)),
'company_car_emp':fields.float('Company car employer', digits=(16,2)),
'company_car_wkr':fields.float('Company Car Deduction for Worker', digits=(16,2)),
'mis_ex_onss':fields.float('Miscellaneous exempt ONSS ', digits=(16,2)),
'ch_value':fields.float('Check Value Meal ', digits=(16,2)),
'ch_worker':fields.float('Check Value Meal - by worker ', digits=(16,2)),
@@ -41,6 +41,11 @@
a) Réduction pour enfants à charge</field>
</record>
<record id="hr_payroll_head_company_car" model="hr.salary.head">
<field name="name">Company car</field>
<field name="code">C.C.</field>
<field name="parent_id" ref="hr_payroll.ALW"/>
</record>
<record id="hr_payroll_head_reim_travel" model="hr.salary.head">
<field name="name">Reimbursement of travel expenses</field>
@@ -123,7 +128,7 @@
<field name="category_id" ref="hr_payroll_head_pp"/>
<field name="name">Precompte Professionnel Bareme 2011</field>
<field name="code">P.P</field>
<field name="sequence">50</field>
<field name="sequence">120</field>
<field name="amount_select">fix</field>
<field name="condition_select">none</field>
<field name="appears_on_payslip" eval="False"/>
@@ -136,10 +141,10 @@
<field name="name">Precompte Professionnel</field>
<field name="code">B.I.</field>
<field name="amount_select">fix</field>
<field name="sequence">50</field>
<field name="sequence">120</field>
<field name="condition_select">python</field>
<field name="condition_python">result = employee.marital=='single'</field>
<field name="appears_on_payslip" eval="False"/>
<field name="condition_python">result = "employee.marital=='single' OR employee.marital=='married' AND statut_fiscal=='with income'"</field>
</record>
<record id="hr_payroll_rules_baremeII" model="hr.salary.rule">
@@ -148,10 +153,10 @@
<field name="name">Precompte Professionnel</field>
<field name="code">B.II</field>
<field name="amount_select">fix</field>
<field name="sequence">50</field>
<field name="sequence">120</field>
<field name="condition_select">python</field>
<field name="condition_python">result = employee.marital=='married'</field>
<field name="appears_on_payslip" eval="False"/>
<field name="condition_python">result = "employee.marital=='married' AND statut_fiscal=='without income'"</field>
</record>
<record id="hr_payroll_rules_baremeIII" model="hr.salary.rule">
@@ -160,7 +165,7 @@
<field name="name">Precompte Professionnel</field>
<field name="code">B.III</field>
<field name="amount_select">fix</field>
<field name="sequence">50</field>
<field name="sequence">120</field>
<field name="condition_select">python</field>
<field name="condition_python">result = employee.marital=='divorced'</field>
<field name="appears_on_payslip" eval="False"/>
@@ -172,13 +177,13 @@
<field name="name">Child Allowance Belgium</field>
<field name="code">Ch.A</field>
<field name="amount_select">fix</field>
<field name="sequence">51</field>
<field name="sequence">60</field>
<field name="condtion_select">range</field>
<field name="condition_range">employee.children</field>
</record>
<record id="hr_payroll_rules_company_car_1" model="hr.salary.rule">
<field name="category_id" ref="hr_payroll.ALW"/>
<record id="hr_payroll_rules_parent_company_car" model="hr.salary.rule">
<field name="category_id" ref="hr_payroll_head_company_car"/>
<field name="name">Company car</field>
<field name="code">car 1</field>
<field name="sequence">15</field>
@@ -198,9 +203,49 @@
<field name="amount_select">code</field>
<field name="amount_python_compute">result = -contract.company_car</field>
</record>
<!-- <record id="hr_payroll_rules_emp_company_car" model="hr.salary.rule">
<field name="category_id" ref="hr_payroll_head_company_car"/>
<field name="parent_rule_id" ref="hr_payroll_rules_parent_company_car"/>
<field name="name">Company car by Employee</field>
<field name="code">C.C.</field>
<field name="type">2</field>
<field name="amount_select">fix</field>
<field name="sequence">60</field>
<field name="condition_select">none</field>
<field name="amount_select">code</field>
<field name="amount_python_compute">result = contract.company_car_emp</field>
</record>
<record id="hr_payroll_rules_wrk_company_car" model="hr.salary.rule">
<field name="category_id" ref="hr_payroll_head_company_car"/>
<field name="parent_rule_id" ref="hr_payroll_rules_parent_company_car"/>
<field name="name">Company car by Worker</field>
<field name="code">C.C.</field>
<field name="type">2</field>
<field name="amount_select">fix</field>
<field name="sequence">60</field>
<field name="condition_select">none</field>
<field name="amount_select">code</field>
<field name="amount_python_compute">result = contract.company_car_wkr</field>
</record>
-->
<record id="hr_payroll_rules_parent_ch" model="hr.salary.rule">
<field name="category_id" ref="hr_payroll_head_ch_value"/>
<field name="name">Check Value Meal</field>
<field name="code">Ch.M.</field>
<field name="type">1</field>
<field name="amount_select">fix</field>
<field name="sequence">65</field>
<field name="condition_select">none</field>
<field name="amount_select">code</field>
<field name="amount_python_compute">result = contract.ch_value</field>
</record>
<record id="hr_payroll_rules_ch_value" model="hr.salary.rule">
<field name="category_id" ref="hr_payroll_head_ch_value"/>
<field name="parent_rule_id" ref="hr_payroll_rules_parent_ch"/>
<field name="name">Check Value Meal</field>
<field name="code">Ch.M.</field>
<field name="amount_select">fix</field>
@@ -241,6 +286,7 @@
<record id="hr_payroll_rules_ch_worker" model="hr.salary.rule">
<field name="category_id" ref="hr_payroll_head_ch_worker"/>
<field name="name">Check Value Meal - by worker</field>
<field name="parent_id" ref="hr_payroll_rules_parent_ch"/>
<field name="code">Ch.wkr</field>
<field name="type">1</field>
<field name="amount_select">fix</field>
@@ -323,6 +369,8 @@
<field name="code">C.P.218</field>
<field name="name">Belgian Employee</field>
<!-- <field eval="[(6, 0, [ref('hr_payroll_rules_onss_rule'),ref('hr_payroll_rules_p_p_b1'),ref('hr_payroll_rules_child_alw')])]" name="rule_ids"/>-->
<field name="company_id" ref="base.main_company"/>
<field eval="[(6, 0, [ref('structure_base')])]" name="rule_ids"/>
</record>
@@ -330,6 +378,8 @@
<field name="code">C.P.219</field>
<field name="name">Belgian Worker</field>
<!-- <field eval="[(6, 0, [ref('hr_payroll_rules_maj'), ref('hr_payroll_rules_onss_rule'),ref('hr_payroll_rules_p_p_b1'),ref('hr_payroll_rules_child_alw')])]" name="rule_ids"/>-->
<field name="company_id" ref="base.main_company"/>
<field eval="[(6, 0, [ref('structure_base')])" name="rule_ids"/>
</record>
</data>
</openerp>
@@ -14,7 +14,8 @@
</xpath>
<xpath expr="/form/notebook/page/group/field[@name='advantages']" position="before">
<field name="reim_travel"/>
<field name="company_car"/>
<field name="company_car_emp"/>
<field name="company_car_wkr"/>
<field name="mis_ex_onss"/>
<field name="ch_value"/>
<field name="ch_worker"/>
@@ -31,16 +32,29 @@
</field>
</record>
<record id="hr_hr_employee_view_for" model="ir.ui.view">
<record id="view_employee_marital_required_form" model="ir.ui.view">
<field name="name">hr.employee.employee.inherit.form</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="marital" position="replace">
<field name="marital" required="True"/>
</field>
</field>
</record>
<record id="hr_contract_hr_hr_employee_view_for" model="ir.ui.view">
<field name="name">hr.hr.employee.view.for</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="sequence">20</field>
<field name="arch" type="xml">
<field name="sequence">20</field>
<field name="arch" type="xml">
<data>
<xpath expr="/form/notebook/page/group/field[@name='marital']" position="after">
<field name="statut_fiscal" help="Only if Married"/>
<field name="handicap" help="Only if Married"/>
<field name="statut_fiscal" attrs="{'invisible':[('marital','!=','married')]}" colspan="1" help="Only if Married"/>
<field name="handicap" attrs="{'invisible':[('marital','!=','married')]}" colspan="1" help="Only if Married"/>
</xpath>
<xpath expr="/form/notebook/page/group/field[@name='children']" position="after">
<field name="handicap_child"/>