diff --git a/addons/account/project/project.py b/addons/account/project/project.py index bc76d84f6f5..a96842ab315 100644 --- a/addons/account/project/project.py +++ b/addons/account/project/project.py @@ -143,6 +143,7 @@ class account_analytic_account(osv.osv): 'stats_ids': fields.one2many('report.hr.timesheet.invoice.journal', 'account_id', string='Statistics', readonly=True), 'company_id': fields.many2one('res.company', 'Company', required=True), 'company_currency_id': fields.function(_get_company_currency, method=True, type='many2one', relation='res.currency', string='Currency'), + 'state': fields.selection([('draft','Draft'), ('open','Open'), ('pending','Pending'), ('close','Close'),], 'State', required=True), } def _default_company(self, cr, uid, context={}): @@ -154,6 +155,7 @@ class account_analytic_account(osv.osv): 'active' : lambda *a : True, 'type' : lambda *a : 'normal', 'company_id': _default_company, + 'state' : lambda *a : 'draft', } _order = 'parent_id desc,code' diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index 3fb471f18b1..10653767da7 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -92,7 +92,8 @@ class hr_analytic_timesheet(osv.osv): a = emp.product_id.product_tmpl_id.property_account_income if not a: a = emp.product_id.categ_id.property_account_income_categ - return a[0] + if a: + return a[0] return False def _getAnalyticJournal(self, cr, uid, context): diff --git a/addons/hr_timesheet/hr_timesheet_view.xml b/addons/hr_timesheet/hr_timesheet_view.xml index 74bcf4b6c5f..7529c80bbdb 100644 --- a/addons/hr_timesheet/hr_timesheet_view.xml +++ b/addons/hr_timesheet/hr_timesheet_view.xml @@ -9,7 +9,7 @@ - + @@ -33,7 +33,7 @@ - + diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index b1fcaea831a..ae14be6d500 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -63,15 +63,6 @@ class account_analytic_account(osv.osv): 'amount_max': fields.float('Max. Invoice Price'), 'amount_invoiced': fields.function(_invoiced_calc, method=True, string='Invoiced Amount'), 'to_invoice': fields.many2one('hr_timesheet_invoice.factor','Invoicing'), - 'state': fields.selection([ - ('draft','Draft'), - ('open','Open'), - ('pending','Pending'), - ('close','Close'), - ], 'State', required=True), - } - _defaults = { - 'state' : lambda *a : 'draft', } account_analytic_account()