From fb7aefa5c31369aad6ebd2b7f67f8cd9b3f6a188 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 13 Jan 2014 17:56:47 +0100 Subject: [PATCH] [FIX] hr_timesheet_invoice: on_change_partner_id, do nothing if partner_id is False bzr revid: dle@openerp.com-20140113165647-152dy1wqgc7m8cc8 --- addons/hr_timesheet_invoice/hr_timesheet_invoice.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index 6393e4025c7..f67c129f863 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -77,10 +77,11 @@ class account_analytic_account(osv.osv): def on_change_partner_id(self, cr, uid, ids, partner_id, name, context=None): res = super(account_analytic_account, self).on_change_partner_id(cr, uid, ids, partner_id, name, context=context) - part = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context) - pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False - if pricelist: - res['value']['pricelist_id'] = pricelist + if partner_id: + part = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context) + pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False + if pricelist: + res['value']['pricelist_id'] = pricelist return res def set_close(self, cr, uid, ids, context=None):