Arnaud Pineux (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-1076015-api into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #1076015 in OpenERP Addons: "[Trunk] Analytic module ->  for id in ids: 
TypeError: 'int' object is not iterable"
  https://bugs.launchpad.net/openobject-addons/+bug/1076015

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1076015-api/+merge/133426

In Analytic/analytic.py
At line: 
for id in ids:
       elmt = self.browse(cr, uid, id, context=context)
       res.append((id, self._get_one_full_name(elmt)))
was replaced by:
full_ids = []
if isinstance(ids,list):
    full_ids.extend(ids)
else:
    full_ids.append(ids)
for id in full_ids:
    elmt = self.browse(cr, uid, id, context=context)
    res.append((id, self._get_one_full_name(elmt)))
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1076015-api/+merge/133426
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-1076015-api.
=== modified file 'analytic/analytic.py'
--- analytic/analytic.py	2012-11-02 16:16:29 +0000
+++ analytic/analytic.py	2012-11-08 09:30:43 +0000
@@ -98,7 +98,12 @@
 
     def name_get(self, cr, uid, ids, context=None):
         res = []
-        for id in ids:
+        full_ids = []
+        if isinstance(ids,list):
+            full_ids.extend(ids)
+        else:
+            full_ids.append(ids)
+        for id in full_ids:
             elmt = self.browse(cr, uid, id, context=context)
             res.append((id, self._get_one_full_name(elmt)))
         return res

=== modified file 'project/project.py'
--- project/project.py	2012-11-02 17:42:00 +0000
+++ project/project.py	2012-11-08 09:30:43 +0000
@@ -203,11 +203,7 @@
     
     def attachment_tree_view(self, cr, uid, ids, context):
         task_ids = self.pool.get('project.task').search(cr, uid, [('project_id', 'in', ids)])
-        domain = [
-            ('|', 
-             '&', 'res_model', '=', 'project.project'), ('res_id', 'in', ids),
-             '&', ('res_model', '=', 'project.task'), ('res_id', 'in', task_ids)
-		]
+        domain = ['|', '&', ('res_model', '=', 'project.project'), ('res_id', 'in', ids), '&', ('res_model', '=', 'project.task'), ('res_id', 'in', task_ids)]
         res_id = ids and ids[0] or False
         return {
             'name': _('Attachments'),

=== modified file 'project_timesheet/project_timesheet.py'
--- project_timesheet/project_timesheet.py	2012-10-29 05:45:52 +0000
+++ project_timesheet/project_timesheet.py	2012-11-08 09:30:43 +0000
@@ -199,8 +199,8 @@
 
                 if amount_unit and 'amount' in amount_unit.get('value',{}):
                     vals_line['amount'] = amount_unit['value']['amount']
-
-            self.pool.get('hr.analytic.timesheet').write(cr, uid, [line_id.id], vals_line, context=context)
+            if line_id.sheet_id.state in ['confirm' 'done']:
+                self.pool.get('hr.analytic.timesheet').write(cr, uid, [line_id.id], vals_line, context=context)
 
         return super(project_work,self).write(cr, uid, ids, vals, context)
 
@@ -241,7 +241,6 @@
             if vals.get('project_id',False):
                 project_obj = self.pool.get('project.project').browse(cr, uid, vals['project_id'], context=context)
                 acc_id = project_obj.analytic_account_id.id
-
             for task_obj in self.browse(cr, uid, ids, context=context):
                 if len(task_obj.work_ids):
                     for task_work in task_obj.work_ids:

_______________________________________________
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