[Fix]hr_timesheet: fix the onchange
bzr revid: sbh@tinyerp.com-20120330095117-lsknoidjybywrsyc
This commit is contained in:
parent
7a97b9c519
commit
26c3e813b2
|
@ -92,7 +92,7 @@
|
||||||
<page string="Account Data">
|
<page string="Account Data">
|
||||||
<group colspan="2" col="2">
|
<group colspan="2" col="2">
|
||||||
<separator colspan="2" string="Contacts"/>
|
<separator colspan="2" string="Contacts"/>
|
||||||
<field name="partner_id" on_change="on_change_partner_id(partner_id)"/>
|
<field name="partner_id"/>
|
||||||
<field name="user_id"/>
|
<field name="user_id"/>
|
||||||
</group>
|
</group>
|
||||||
<group colspan="2" col="2" name="contract">
|
<group colspan="2" col="2" name="contract">
|
||||||
|
|
|
@ -78,14 +78,12 @@ class account_analytic_account(osv.osv):
|
||||||
'pricelist_id': lambda self, cr, uid, ctx: ctx.get('pricelist_id', False),
|
'pricelist_id': lambda self, cr, uid, ctx: ctx.get('pricelist_id', False),
|
||||||
}
|
}
|
||||||
def on_change_partner_id(self, cr, uid, id, partner_id, context={}):
|
def on_change_partner_id(self, cr, uid, id, partner_id, context={}):
|
||||||
res = super(account_analytic_account, self).on_change_partner_id(cr, uid, id, partner_id, context)
|
res={}
|
||||||
if (not res.get('value', False)) or not partner_id:
|
|
||||||
return res
|
|
||||||
part = self.pool.get('res.partner').browse(cr, uid, partner_id)
|
part = self.pool.get('res.partner').browse(cr, uid, partner_id)
|
||||||
pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
|
pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
|
||||||
if pricelist:
|
if pricelist:
|
||||||
res['value']['pricelist_id'] = pricelist
|
res['pricelist_id'] = pricelist
|
||||||
return res
|
return {'value': res}
|
||||||
|
|
||||||
def set_close(self, cr, uid, ids, context=None):
|
def set_close(self, cr, uid, ids, context=None):
|
||||||
return self.write(cr, uid, ids, {'state':'close'}, context=context)
|
return self.write(cr, uid, ids, {'state':'close'}, context=context)
|
||||||
|
|
Loading…
Reference in New Issue