[FIX] hr_expense: hr_expense not working when Employee is not assigned user_id

lp bug: https://launchpad.net/bugs/703902 fixed

bzr revid: mra@mra-laptop-20110117122113-blnbg42tr0oxh5ny
This commit is contained in:
Mustufa Rangwala 2011-01-17 17:51:13 +05:30
parent 218ed6b582
commit 29110b6487
1 changed files with 8 additions and 4 deletions

View File

@ -251,13 +251,17 @@ class hr_expense_line(osv.osv):
product = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
res['name'] = product.name
# Compute based on pricetype of employee company
ctx['currency_id'] = self.pool.get('hr.employee').browse(cr, uid, employee_id, context=context).user_id.company_id.currency_id.id
amount_unit = product.price_get('standard_price', ctx)[product.id]
res['unit_amount'] = amount_unit
employee = self.pool.get('hr.employee').browse(cr, uid, employee_id, context=context)
if employee.user_id:
ctx['currency_id'] = self.pool.get('hr.employee').browse(cr, uid, employee_id, context=context).user_id.company_id.currency_id.id
amount_unit = product.price_get('standard_price', ctx)[product.id]
res['unit_amount'] = amount_unit
else:
res['unit_amount'] = product.standard_price
if not uom_id:
res['uom_id'] = product.uom_id.id
return {'value': res}
hr_expense_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: