From 26c3e813b2fb8c686555c59a8e795a701eb6ff34 Mon Sep 17 00:00:00 2001 From: "Sbh (Openerp)" Date: Fri, 30 Mar 2012 15:21:17 +0530 Subject: [PATCH] [Fix]hr_timesheet: fix the onchange bzr revid: sbh@tinyerp.com-20120330095117-lsknoidjybywrsyc --- addons/account/project/project_view.xml | 2 +- .../hr_timesheet_invoice/hr_timesheet_invoice.py | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml index 2998ea72e34..328cedb9bc1 100644 --- a/addons/account/project/project_view.xml +++ b/addons/account/project/project_view.xml @@ -92,7 +92,7 @@ - + diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index 11b7bb771fa..0a58efb782b 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -78,24 +78,22 @@ class account_analytic_account(osv.osv): 'pricelist_id': lambda self, cr, uid, ctx: ctx.get('pricelist_id', False), } 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) - if (not res.get('value', False)) or not partner_id: - return res + res={} part = self.pool.get('res.partner').browse(cr, uid, partner_id) pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False if pricelist: - res['value']['pricelist_id'] = pricelist - return res + res['pricelist_id'] = pricelist + return {'value': res} def set_close(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state':'close'}, context=context) - + def set_cancel(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state':'cancelled'}, context=context) - + def set_open(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state':'open'}, context=context) - + def set_pending(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state':'pending'}, context=context)