[IMP]project_timesheet:added method for setting default product.
bzr revid: kbh@tinyerp.com-20121012082525-y600x8lv0xteej6a
This commit is contained in:
parent
fc94df2af5
commit
86676cf1c9
|
@ -284,6 +284,19 @@ class account_analytic_line(osv.osv):
|
||||||
raise osv.except_osv(_('Invalid Analytic Account !'), _('You cannot select a Analytic Account which is in Close or Cancelled state.'))
|
raise osv.except_osv(_('Invalid Analytic Account !'), _('You cannot select a Analytic Account which is in Close or Cancelled state.'))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def _default_product(self, cr, uid, context=None):
|
||||||
|
proxy = self.pool.get('hr.employee')
|
||||||
|
record_ids = proxy.search(cr, uid, [('user_id', '=', uid)], context=context)
|
||||||
|
print "record_ids",record_ids
|
||||||
|
employee = proxy.browse(cr, uid, record_ids[0], context=context)
|
||||||
|
if employee.product_id:
|
||||||
|
return employee.product_id.id
|
||||||
|
return False
|
||||||
|
|
||||||
|
_defaults = {
|
||||||
|
'product_id': _default_product,
|
||||||
|
}
|
||||||
|
|
||||||
account_analytic_line()
|
account_analytic_line()
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
Loading…
Reference in New Issue