← Back to team overview

openerp-india team mailing list archive

[Bug 1038987] [NEW] 6.1 in timesheet sheet with web client you have to save sheet before writing lines

 

Public bug reported:

6.1 in timesheet sheet with web client you have to save sheet before
writing lines else you have no user_id set.

Following patch should do the trick. Sorry but launchpad trouble prevent
me to do  a merge prop.

Nicolas


=== modified file 'hr_timesheet_sheet/wizard/hr_timesheet_current.py'
--- hr_timesheet_sheet/wizard/hr_timesheet_current.py	2011-01-14 00:11:01 +0000
+++ hr_timesheet_sheet/wizard/hr_timesheet_current.py	2012-08-20 11:38:24 +0000
@@ -45,7 +45,9 @@
             ts.write(cr, uid, ids, {'date_current': time.strftime('%Y-%m-%d')}, context=context)
             domain = "[('user_id', '=', uid)]"
         else:
-            domain = "[('user_id', '=', uid)]"
+            tid = ts.create(cr, uid, ids, {'user_id': uid, 'date_current': time.strftime('%Y-%m-%d')})
+            domain = "[('id', '=', %s)]" % (tid)
+            ids.append(tid)
         value = {
             'domain': domain,
             'name': _('Open Timesheet'),
@@ -53,7 +55,8 @@
             'view_mode': view_type,
             'res_model': 'hr_timesheet_sheet.sheet',
             'view_id': False,
-            'type': 'ir.actions.act_window'
+            'type': 'ir.actions.act_window',
+            'context': {'user_id':uid}
         }
         if len(ids) == 1:
             value['res_id'] = ids[0]

** Affects: openobject-addons
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1038987

Title:
  6.1 in timesheet sheet with web client you have to save sheet before
  writing lines

Status in OpenERP Addons (modules):
  New

Bug description:
  6.1 in timesheet sheet with web client you have to save sheet before
  writing lines else you have no user_id set.

  Following patch should do the trick. Sorry but launchpad trouble
  prevent me to do  a merge prop.

  Nicolas


  === modified file 'hr_timesheet_sheet/wizard/hr_timesheet_current.py'
  --- hr_timesheet_sheet/wizard/hr_timesheet_current.py	2011-01-14 00:11:01 +0000
  +++ hr_timesheet_sheet/wizard/hr_timesheet_current.py	2012-08-20 11:38:24 +0000
  @@ -45,7 +45,9 @@
               ts.write(cr, uid, ids, {'date_current': time.strftime('%Y-%m-%d')}, context=context)
               domain = "[('user_id', '=', uid)]"
           else:
  -            domain = "[('user_id', '=', uid)]"
  +            tid = ts.create(cr, uid, ids, {'user_id': uid, 'date_current': time.strftime('%Y-%m-%d')})
  +            domain = "[('id', '=', %s)]" % (tid)
  +            ids.append(tid)
           value = {
               'domain': domain,
               'name': _('Open Timesheet'),
  @@ -53,7 +55,8 @@
               'view_mode': view_type,
               'res_model': 'hr_timesheet_sheet.sheet',
               'view_id': False,
  -            'type': 'ir.actions.act_window'
  +            'type': 'ir.actions.act_window',
  +            'context': {'user_id':uid}
           }
           if len(ids) == 1:
               value['res_id'] = ids[0]

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1038987/+subscriptions


Follow ups

References