From 91d7b2e168a5c9754e771f058b763357bb1c4a73 Mon Sep 17 00:00:00 2001 From: Hardik Date: Wed, 29 Aug 2012 16:58:40 +0530 Subject: [PATCH] [IMP]Sale : Contract allowed timesheet, click on the link all timesheet and create a new entry bzr revid: hsa@tinyerp.com-20120829112840-9vw1git194zc68eo --- addons/hr_timesheet/hr_timesheet_view.xml | 6 +++--- addons/hr_timesheet_invoice/hr_timesheet_invoice.py | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/addons/hr_timesheet/hr_timesheet_view.xml b/addons/hr_timesheet/hr_timesheet_view.xml index d364d605b5f..af6d2114211 100644 --- a/addons/hr_timesheet/hr_timesheet_view.xml +++ b/addons/hr_timesheet/hr_timesheet_view.xml @@ -9,14 +9,14 @@ - + - + - + diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index 4cba4a18680..2d59a3779c6 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -129,15 +129,18 @@ class account_analytic_line(osv.osv): def _default_journal(self, cr, uid, context=None): proxy = self.pool.get('hr.employee') record_ids = proxy.search(cr, uid, [('user_id', '=', uid)], context=context) - employee = proxy.browse(cr, uid, record_ids[0], context=context) - return employee.journal_id and employee.journal_id.id or False + if record_ids: + employee = proxy.browse(cr, uid, record_ids[0], context=context) + return employee.journal_id and employee.journal_id.id or False + return False def _default_general_account(self, cr, uid, context=None): proxy = self.pool.get('hr.employee') record_ids = proxy.search(cr, uid, [('user_id', '=', uid)], context=context) - employee = proxy.browse(cr, uid, record_ids[0], context=context) - if employee.product_id and employee.product_id.property_account_income: - return employee.product_id.property_account_income.id + if record_ids: + employee = proxy.browse(cr, uid, record_ids[0], context=context) + if employee.product_id and employee.product_id.property_account_income: + return employee.product_id.property_account_income.id return False _defaults = {