Rifakat (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-575493-rha into 
lp:openobject-addons/6.1.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)
Related bugs:
  Bug #953006 in OpenERP Addons: "project_timesheet: impossible to edit a task 
work"
  https://bugs.launchpad.net/openobject-addons/+bug/953006

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-575493-rha/+merge/108887

Hello,

Fixed journal_id keyerror while a user tries to edit the task work entry from 
task.
Did a code refactor in order to get the value of journal_id. (Courtesy to Amit 
Parikh <[email protected]>)

Thanks for your review,
Rifakat Haradwala


-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-575493-rha/+merge/108887
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-575493-rha.
=== modified file 'project_timesheet/project_timesheet.py'
--- project_timesheet/project_timesheet.py	2012-01-31 13:36:57 +0000
+++ project_timesheet/project_timesheet.py	2012-06-06 06:59:24 +0000
@@ -142,10 +142,6 @@
                 vals_line['name'] = '%s: %s' % (tools.ustr(task.task_id.name), tools.ustr(vals['name']) or '/')
             if 'user_id' in vals:
                 vals_line['user_id'] = vals['user_id']
-                result = self.get_user_related_details(cr, uid, vals['user_id'])
-                for fld in ('product_id', 'general_account_id', 'journal_id', 'product_uom_id'):
-                    if result.get(fld, False):
-                        vals_line[fld] = result[fld]
                         
             if 'date' in vals:
                 vals_line['date'] = vals['date'][:10]
@@ -153,6 +149,10 @@
                 default_uom = self.pool.get('res.users').browse(cr, uid, uid).company_id.project_time_mode_id.id
                 vals_line['unit_amount'] = vals['hours']
                 prod_id = vals_line.get('product_id', line_id.product_id.id) # False may be set
+                result = self.get_user_related_details(cr, uid, vals.get('user_id', task.user_id.id))
+                for fld in ('product_id', 'general_account_id', 'journal_id', 'product_uom_id'):
+                    if result.get(fld, False):
+                        vals_line[fld] = result[fld]
 
                 if result.get('product_uom_id',False) and (not result['product_uom_id'] == default_uom):
                     vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, default_uom, vals['hours'], result['product_uom_id'])

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to