Modifs for multi-user
bzr revid: fp@tinyerp.com-02f315208b2b293f86baaf4518f5efd796c4a172
This commit is contained in:
parent
b6877ee0f1
commit
af911b0929
|
@ -65,8 +65,9 @@ class hr_analytic_timesheet(osv.osv):
|
|||
return res
|
||||
|
||||
def _getEmployeeProduct(self, cr, uid, context):
|
||||
print context
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))])
|
||||
if emp_id:
|
||||
emp=emp_obj.browse(cr, uid, emp_id[0], context)
|
||||
if emp.product_id:
|
||||
|
@ -75,7 +76,7 @@ class hr_analytic_timesheet(osv.osv):
|
|||
|
||||
def _getEmployeeUnit(self, cr, uid, context):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))])
|
||||
if emp_id:
|
||||
emp=emp_obj.browse(cr, uid, emp_id[0], context)
|
||||
if emp.product_id:
|
||||
|
@ -84,7 +85,7 @@ class hr_analytic_timesheet(osv.osv):
|
|||
|
||||
def _getGeneralAccount(self, cr, uid, context):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))])
|
||||
if emp_id:
|
||||
emp = self.pool.get('hr.employee').browse(cr, uid, emp_id[0], context=context)
|
||||
if bool(emp.product_id):
|
||||
|
@ -95,8 +96,9 @@ class hr_analytic_timesheet(osv.osv):
|
|||
return False
|
||||
|
||||
def _getAnalyticJournal(self, cr, uid, context):
|
||||
print 'CONTEXT', context
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))])
|
||||
if emp_id:
|
||||
emp = self.pool.get('hr.employee').browse(cr, uid, emp_id[0], context=context)
|
||||
if emp.journal_id:
|
||||
|
@ -109,7 +111,7 @@ class hr_analytic_timesheet(osv.osv):
|
|||
'product_id' : _getEmployeeProduct,
|
||||
'general_account_id' : _getGeneralAccount,
|
||||
'journal_id' : _getAnalyticJournal,
|
||||
'user_id' : lambda obj, cr, uid, ctx : uid,
|
||||
'user_id' : lambda obj, cr, uid, ctx : ctx.get('user_id', uid),
|
||||
}
|
||||
|
||||
def on_change_account_id(self, cr, uid, ids, account_id):
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
</group>
|
||||
<button string="Sign In" name="sign_in" type="object"/>
|
||||
<button string="Sign Out" name="sign_out" type="object"/>
|
||||
<field name="attendances_ids" colspan="4" nolabel="1" context="name=date_current" height="100">
|
||||
<field name="attendances_ids" colspan="4" nolabel="1" context="name=date_current,user_id=user_id" height="100">
|
||||
<tree string="Attendances">
|
||||
<field name="employee_id"/>
|
||||
<field name="name"/>
|
||||
|
@ -65,17 +65,19 @@
|
|||
</field>
|
||||
<field name="state_attendance"/>
|
||||
<field name="total_attendance_day" widget="float_time"/>
|
||||
<field name="timesheet_ids" colspan="4" nolabel="1" domain="[('name','=',date_current)]" context="date=date_current">
|
||||
<field name="timesheet_ids" colspan="4" nolabel="1" domain="[('name','=',date_current)]" context="date=date_current,user_id=user_id">
|
||||
<tree string="Timesheet" editable="top">
|
||||
<field name="user_id" required="1"/>
|
||||
<field name="date" />
|
||||
<field name="account_id" on_change="on_change_account_id(account_id)" domain="[('type','=','normal')]"/>
|
||||
<field name="name" />
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" widget="float_time"/>
|
||||
<field name="journal_id" invisible="True"/>
|
||||
<field name="product_id" invisible="True"/>
|
||||
<field name="product_uom_id" invisible="True" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" />
|
||||
<field name="amount" invisible="True"/>
|
||||
<field name="general_account_id" invisible="True"/>
|
||||
<field name="journal_id" invisible="True"/>
|
||||
<field name="to_invoice"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
|
Loading…
Reference in New Issue