HR_TIMESHEET : Improved view : the product
bzr revid: bch-c5a86aba094991c3adbae6fd16848375efc53754
This commit is contained in:
parent
6bd9d4fc26
commit
03ce87ba8e
|
@ -59,6 +59,7 @@ class hr_analytic_timesheet(osv.osv):
|
|||
self.pool.get('account.analytic.line').unlink(cr, uid, toremove.keys(), context)
|
||||
return super(hr_analytic_timesheet, self).unlink(cr, uid, ids, context)
|
||||
|
||||
|
||||
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, unit, context={}):
|
||||
res = {}
|
||||
if prod_id and unit_amount:
|
||||
|
@ -122,4 +123,17 @@ class hr_analytic_timesheet(osv.osv):
|
|||
account = self.pool.get('account.analytic.account').read(cr, uid, [account_id], ['name'])[0]['name']
|
||||
user = self.pool.get('res.users').read(cr, uid, [uid], ['name'])[0]['name']
|
||||
return {'value' : {'name' : '%s (%s)' % (account, user)}}
|
||||
|
||||
def on_change_user_id(self, cr, uid, ids, user_id):
|
||||
if not user_id:
|
||||
return {}
|
||||
return {'value' : {
|
||||
'product_id' : self._getEmployeeProduct(cr,user_id, context= {}),
|
||||
'product_uom_id' : self._getEmployeeUnit(cr, user_id, context= {}),
|
||||
'general_account_id' :self. _getGeneralAccount(cr, user_id, context= {}),
|
||||
'journal_id' : self._getAnalyticJournal(cr, user_id, context= {}),
|
||||
}}
|
||||
|
||||
|
||||
|
||||
hr_analytic_timesheet()
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Timesheet Line" editable="bottom">
|
||||
<field name="user_id" required="1"/>
|
||||
<field name="user_id" required="1" on_change="on_change_user_id(user_id)"/>
|
||||
<field name="date" />
|
||||
<field name="account_id" on_change="on_change_account_id(account_id)" domain="[('type','=','normal'),('state', '<>', 'close')]"/>
|
||||
<field name="name" />
|
||||
|
@ -26,7 +26,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Timesheet Lines">
|
||||
<field name="name" colspan="4"/>
|
||||
<field name="user_id" select="1" required="1"/>
|
||||
<field name="user_id" select="1" required="1" on_change="on_change_user_id(user_id)"/>
|
||||
<field name="date" select="1"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" />
|
||||
<newline/>
|
||||
|
|
Loading…
Reference in New Issue