[MERGE]: Merge with lp:openobject-trunk-dev-addons2

bzr revid: aag@tinyerp.co.in-20101027050818-34ewnzl377brkavp
This commit is contained in:
aag (OpenERP)
2010-10-27 10:38:18 +05:30
7 changed files with 96 additions and 59 deletions
+1
View File
@@ -16,6 +16,7 @@
<field name="date"/>
<field name="user_id" invisible="1"/>
<field name="parent_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
</tree>
</field>
</record>
+62 -50
View File
@@ -86,7 +86,7 @@ class hr_payroll_structure(osv.osv):
- Allowlance
- Deductions
"""
_name = 'hr.payroll.structure'
_description = 'Salary Structure'
_columns = {
@@ -130,14 +130,14 @@ class hr_contract(osv.osv):
Employee contract based on the visa, work permits
allowas to configure different Salary structure
"""
def compute_basic(self, cr, uid, ids, context={}):
res = {}
ids += context.get('employee_structure', [])
slip_pool = self.pool.get('hr.payslip')
slip_line_pool = self.pool.get('hr.payslip.line')
for contract in self.browse(cr, uid, ids, context):
all_per = 0.0
ded_per = 0.0
@@ -154,20 +154,20 @@ class hr_contract(osv.osv):
if contract.wage_type_id.type == 'basic':
obj['basic'] = contract.wage
update['basic'] = contract.wage
sal_type = contract.wage_type_id.type
function = contract.struct_id.id
lines = contract.struct_id.line_ids
if not contract.struct_id:
res[contract.id] = obj['basic']
continue
continue
ad = []
c_type = {}
for line in lines:
cd = line.code.lower()
obj[cd] = line.amount or 0.0
for line in lines:
if line.category_id.code in ad:
continue
@@ -237,16 +237,16 @@ class hr_contract(osv.osv):
basic = (sal * 100) / final
else:
basic = contract.wage
res[contract.id] = basic
return res
def check_vals(self, val1, val2):
if val1 == val2 and val1 == 0:
return True
return False
def _calculate_salary(self, cr, uid, ids, field_names, arg, context=None):
res = self.compute_basic(cr, uid, ids, context)
vals = {}
@@ -259,7 +259,7 @@ class hr_contract(osv.osv):
obj['gross'] = rs.wage
if rs.wage_type_id.type == 'net':
obj['net'] = rs.net
if not rs.struct_id:
if self.check_vals(obj['basic'], obj['gross']):
obj['gross'] = obj['basic'] = obj['net']
@@ -276,7 +276,7 @@ class hr_contract(osv.osv):
}
vals[rs.id] = record
continue
for line in rs.struct_id.line_ids:
amount = 0.0
if line.amount_type == 'per':
@@ -288,7 +288,7 @@ class hr_contract(osv.osv):
amount = line.amount
cd = line.category_id.code.lower()
obj[cd] = amount
if line.type == 'allowance':
allow += amount
elif line.type == 'deduction':
@@ -334,7 +334,7 @@ class payroll_register(osv.osv):
"""
Payroll Register
"""
_name = 'hr.payroll.register'
_description = 'Payroll Register'
@@ -425,6 +425,18 @@ class payroll_register(osv.osv):
self.write(cr, uid, ids, {'state':'draft', 'number':number}, context=context)
return True
def set_to_draft(self, cr, uid, ids, context=None):
if context is None:
context = {}
self.write(cr, uid, ids, {'state':'draft'}, context=context)
return True
def cancel_sheet(self, cr, uid, ids, context=None):
if context is None:
context = {}
self.write(cr, uid, ids, {'state':'cancel'}, context=context)
return True
def verify_sheet(self, cr, uid, ids, context=None):
if context is None:
context = {}
@@ -453,7 +465,7 @@ class payroll_register(osv.osv):
wf_service = netsvc.LocalService("workflow")
for sid in sids:
wf_service.trg_validate(uid, 'hr.payslip', sid, 'final_verify_sheet', cr)
company_name = users_pool.browse(cr, uid, uid, context=context).company_id.name
for reg in self.browse(cr, uid, ids, context=context):
advice = {
@@ -462,7 +474,7 @@ class payroll_register(osv.osv):
'register_id':reg.id
}
pid = advice_pool.create(cr, uid, advice, context=context)
for slip in reg.line_ids:
if not slip.employee_id.bank_account_id:
raise osv.except_osv(_('Error !'), _('Please define bank account for the %s employee' % (slip.employee_id.name)))
@@ -495,7 +507,7 @@ class payroll_advice(osv.osv):
'''
Bank Advice Note
'''
_name = 'hr.payroll.advice'
_description = 'Bank Advice Note'
_columns = {
@@ -557,7 +569,7 @@ class payroll_advice_line(osv.osv):
'''
Bank Advice Lines
'''
_name = 'hr.payroll.advice.line'
_description = 'Bank Advice Lines'
_columns = {
@@ -595,7 +607,7 @@ class contrib_register(osv.osv):
'''
Contribution Register
'''
_name = 'hr.contibution.register'
_description = 'Contribution Register'
@@ -635,7 +647,7 @@ class contrib_register_line(osv.osv):
'''
Contribution Register Line
'''
_name = 'hr.contibution.register.line'
_description = 'Contribution Register Line'
@@ -745,7 +757,7 @@ class company_contribution(osv.osv):
self.pool.get('res.users').browse(cr, uid, uid,
context=context).company_id.id,
}
def _execute_function(self, cr, uid, id, value, context=None):
"""
self: pointer to self object
@@ -764,7 +776,7 @@ class company_contribution(osv.osv):
else:
res = line_pool.browse(cr, uid, ids, context=context)[0].value
return res
def compute(self, cr, uid, id, value, context={}):
contrib = self.browse(cr, uid, id, context)
if contrib.amount_type == 'fix':
@@ -798,7 +810,7 @@ class company_contribution_line(osv.osv):
company_contribution_line()
class hr_holidays_status(osv.osv):
_inherit = "hr.holidays.status"
_columns = {
'company_id':fields.many2one('res.company', 'Company', required=False),
@@ -823,7 +835,7 @@ class hr_payslip(osv.osv):
'''
Pay Slip
'''
_name = 'hr.payslip'
_description = 'Pay Slip'
@@ -981,12 +993,12 @@ class hr_payslip(osv.osv):
context = {}
self.write(cr, uid, ids, {'paid':True, 'state':'done'}, context=context)
return True
def verify_sheet(self, cr, uid, ids, context={}):
payslip_pool = self.pool.get('hr.payslip.line')
register_pool = self.pool.get('company.contribution')
register_line_pool = self.pool.get('hr.contibution.register.line')
for slip in self.browse(cr, uid, ids, context=context):
base = {
'basic':slip.basic,
@@ -1009,7 +1021,7 @@ class hr_payslip(osv.osv):
'total':line.total + line.total
}
register_line_pool.create(cr, uid, reg_line)
self.write(cr, uid, ids, {'state':'confirm'}, context=context)
return True
@@ -1084,7 +1096,7 @@ class hr_payslip(osv.osv):
count += 1
return count
for slip in self.browse(cr, uid, ids, context=context):
for slip in self.browse(cr, uid, ids, context=context):
old_slip_ids = slip_line_pool.search(cr, uid, [('slip_id','=',slip.id)], context=context)
slip_line_pool.unlink(cr, uid, old_slip_ids, context=context)
update = {}
@@ -1224,7 +1236,7 @@ class hr_payslip(osv.osv):
'contract_id':contract.id,
'company_id':slip.employee_id.company_id.id
})
for line in slip.employee_id.line_ids:
vals = {
'amount':line.amount,
@@ -1234,7 +1246,7 @@ class hr_payslip(osv.osv):
'base':base
}
slip_line_pool.copy(cr, uid, line.id, vals, {})
self.write(cr, uid, [slip.id], update, context=context)
for slip in self.browse(cr, uid, ids, context=context):
@@ -1260,7 +1272,7 @@ class hr_payslip(osv.osv):
for hday in holiday_pool.browse(cr, uid, leave_ids, context=context):
if not hday.holiday_status_id.head_id:
raise osv.except_osv(_('Error !'), _('Please check configuration of %s, payroll head is missing' % (hday.holiday_status_id.name)))
res = {
'slip_id':slip.id,
'name':hday.holiday_status_id.name + '-%s' % (hday.number_of_days),
@@ -1281,7 +1293,7 @@ class hr_payslip(osv.osv):
# res['type'] = 'allowance'
# leave += days
# total += perday * days
elif hday.holiday_status_id.type == 'halfpaid':
paid_leave += (days / 2)
res['name'] = hday.holiday_status_id.name + '-%s/2' % (days)
@@ -1315,7 +1327,7 @@ class hr_payslip_line(osv.osv):
'''
Payslip Line
'''
_name = 'hr.payslip.line'
_description = 'Payslip Line'
@@ -1346,7 +1358,7 @@ class hr_payslip_line(osv.osv):
'employee_id':fields.many2one('hr.employee', 'Employee', required=False),
'name':fields.char('Name', size=256, required=True, readonly=False),
'base':fields.char('Formula', size=1024, required=False, readonly=False),
'code':fields.char('Code', size=64, required=False, readonly=False),
'code':fields.char('Code', size=64, required=False, readonly=False),
'category_id':fields.many2one('hr.allounce.deduction.categoty', 'Category', required=True),
'type':fields.selection([
('allowance','Allowance'),
@@ -1397,7 +1409,7 @@ class hr_payslip_line_line(osv.osv):
'''
Function Line
'''
_name = 'hr.payslip.line.line'
_description = 'Function Line'
_order = 'sequence'
@@ -1418,28 +1430,28 @@ class hr_employee(osv.osv):
'''
Employee
'''
_inherit = 'hr.employee'
_description = 'Employee'
def _calculate_salary(self, cr, uid, ids, field_names, arg, context=None):
vals = {}
slip_line_pool = self.pool.get('hr.payslip.line')
for employee in self.browse(cr, uid, ids, context):
if not employee.contract_id:
vals[employee.id] = {'basic':0.0, 'gross':0.0, 'net':0.0, 'advantages_gross':0.0, 'advantages_net':0.0}
continue
basic = employee.contract_id.basic
gross = employee.contract_id.gross
net = employee.contract_id.net
allowance = employee.contract_id.advantages_gross
deduction = employee.contract_id.advantages_net
obj = {
'basic':basic,
'gross':gross,
'basic':basic,
'gross':gross,
'net':net
}
for line in employee.line_ids:
@@ -1455,27 +1467,27 @@ class hr_employee(osv.osv):
amount = slip_line_pool.execute_function(cr, uid, line.id, amt, context)
elif line.amount_type == 'fix':
amount = line.amount
if line.type == 'allowance':
allowance += amount
elif line.type == 'deduction':
deduction += amount
vals[employee.id] = {
'basic':basic,
'advantages_gross':allowance,
'gross':basic + allowance,
'basic':basic,
'advantages_gross':allowance,
'gross':basic + allowance,
'advantages_net':deduction,
'net':basic + allowance - deduction
}
return vals
_columns = {
'passport_id':fields.many2one('hr.passport', 'Passport', required=False, domain="[('employee_id','=',active_id), ('address_id','=',address_home_id)]", help="Employee Passport Information"),
'line_ids':fields.one2many('hr.payslip.line', 'employee_id', 'Salary Structure', required=False),
'slip_ids':fields.one2many('hr.payslip', 'employee_id', 'Payslips', required=False, readonly=True),
'otherid': fields.char('Other Id', size=64),
'basic': fields.function(_calculate_salary, method=True, multi='dc', type='float', string='Basic Salary', digits=(14,2)),
'gross': fields.function(_calculate_salary, method=True, multi='dc', type='float', string='Gross Salary', digits=(14,2)),
'net': fields.function(_calculate_salary, method=True, multi='dc', type='float', string='Net Salary', digits=(14,2)),
@@ -127,9 +127,9 @@
</group>
</page>
</notebook>
<field name="state"/>
<group col="4" colspan="2">
<button name="button_confirm" states="draft" string="Close" type="object" icon="terp-check"/>
<group col="6" colspan="4">
<field name="state"/>
<button name="button_confirm" states="draft" string="Confirm" type="object" icon="terp-check"/>
<button name="action_set_to_draft" states="done" string="Set to Draft" type="object" icon="terp-stock_effects-object-colorize"/>
<button name="cancel" states="confirm" string="Refuse" type="workflow" icon="gtk-cancel"/>
<button name="done" states="confirm" string="Approve" type="workflow" icon="terp-camera_test"/>
+1 -1
View File
@@ -325,7 +325,7 @@
<field name="progress" widget="progressbar" invisible="context.get('set_visible',False)"/>
<field name="state" invisible="context.get('set_visible',False)"/>
<button name="do_cancel" states="draft,open,pending" string="Cancel" type="object" icon="gtk-cancel" help="For cancelling the task"/>
<button name="do_open" states="pending,draft,done,cancel" string="Start Task" type="object" icon="gtk-execute" help="For changing to open state" invisible="context.get('set_visible',False)"/>
<button name="do_open" states="pending,draft,done,cancelled" string="Start Task" type="object" icon="gtk-execute" help="For changing to open state" invisible="context.get('set_visible',False)"/>
<button groups="base.group_extended" name="%(action_project_task_delegate)d" states="pending,open,draft" string="Delegate" type="action" icon="gtk-sort-descending" help="For changing to delegate state"/>
<button name="action_close" states="draft,pending,open" string="Done" type="object" icon="terp-dialog-close" help="For changing to done state"/>
</tree>
@@ -7,14 +7,14 @@
<field name="model">project.task.close</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Send Email" >
<form string="Send Email">
<group colspan="4" col="4">
<field name="manager_warn" invisible="1"/>
<field name="manager_email" widget="email" attrs="{'invisible':[('manager_warn','=',False)], 'required':[('manager_warn','=',True)]}"/>
<field name="manager_email" widget="email" attrs="{'invisible':[('manager_warn','=',False)], 'required':[('manager_warn','=',True)]}" width="250"/>
<field name="partner_warn" invisible="1"/>
<field name="partner_email" widget="email" attrs="{'invisible':[('partner_warn','=',False)], 'required':[('partner_warn','=',True)]}"/>
<separator string="Warn Message" colspan="4"/>
<field name="description" nolabel="1" colspan="4"/>
<field name="description" nolabel="1" colspan="4" width="200" height="150"/>
</group>
<separator string="" colspan="4"/>
<group colspan="2" col="2">
+2 -2
View File
@@ -93,7 +93,7 @@
<button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert"/>
</group>
</page>
<page string="Emails" groups="base.group_extended">
<page string="History" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="Global CC" widget="url"/>
</group>
@@ -146,7 +146,7 @@
context="{'mail':'new', 'model': 'project.issue'}"
icon="terp-mail-message-new" type="action" />
</page>
<page string="History" groups="base.group_extended">
<page string="Extra Info" groups="base.group_extended">
<group col="2" colspan="2">
<separator colspan="2" string="Date"/>
<field name="create_date"/>
@@ -346,6 +346,30 @@
</field>
</record>
<record id="view_phase_task_search_form_group" model="ir.ui.view">
<field name="name">phase.task.search.form.group</field>
<field name="model">project.task</field>
<field name="type">search</field>
<field name="inherit_id" ref="project.view_task_search_form"/>
<field name="arch" type="xml">
<filter string="Project" name="group_project_id" icon="terp-folder-violet" domain="[]" context="{'group_by':'project_id'}" position="after">
<filter string="Project Phase" name="group_project_id_phase" icon="terp-folder-violet" domain="[]" context="{'group_by':'phase_id'}" groups="base.group_extended"/>
</filter>
</field>
</record>
<record id="view_phase_task_search_form_tree" model="ir.ui.view">
<field name="name">phase.task.search.form.tree</field>
<field name="model">project.task</field>
<field name="type">tree</field>
<field name="inherit_id" ref="project.view_task_tree2"/>
<field name="arch" type="xml">
<field name="project_id" position="after">
<field name="phase_id" invisible="1" groups="base.group_extended"/>
</field>
</field>
</record>
<act_window
id="project_phase_task_list"
name="Related Tasks"