Chris Biersbach (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/7.0-fix_issue_stages-cbi into 
lp:openobject-addons/7.0.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/7.0-fix_issue_stages-cbi/+merge/141766

The issue: IN the project issue form view, the statusbar does not contain all 
the stages of the issue's project.
In the kanban view, some empty stages do not appear as well

The reason: For the statusbar, the domain defined on stage_id is the culprit, 
fold by default stages are not shown (I don't know why, this does not make any 
sense). In the kanban view, the group_by_full is wrong. It wants to get a value 
(default_project_id) from the context, which is clearly wrong. If you have 
issues from several projects, you will never get the right stages. On top of 
this, this value may not be in the context, then you do not even get all the 
stages of one project.

The fix: For the form view, I removed the fold = false clause from the domain. 
For the kanban view, I wrote a small method to get all the projects a user is a 
member of. The kanban view then shows the stages of all of these projects.


-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/7.0-fix_issue_stages-cbi/+merge/141766
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/7.0-fix_issue_stages-cbi.
=== modified file 'project_issue/project_issue.py'
--- project_issue/project_issue.py	2013-01-03 15:06:53 +0000
+++ project_issue/project_issue.py	2013-01-03 15:37:26 +0000
@@ -99,6 +99,9 @@
             if len(project_ids) == 1:
                 return int(project_ids[0][0])
         return None
+    
+    def _get_user_projects(self, cr, uid):
+        return self.pool.get('project.project').search(cr, uid, [('members', '=', uid)])
 
     def _read_group_stage_ids(self, cr, uid, ids, domain, read_group_order=None, access_rights_uid=None, context=None):
         access_rights_uid = access_rights_uid or uid
@@ -112,8 +115,8 @@
         # - OR ('case_default', '=', True), ('fold', '=', False): add default columns that are not folded
         # - OR ('project_ids', 'in', project_id), ('fold', '=', False) if project_id: add project columns that are not folded
         search_domain = []
-        project_id = self._resolve_project_id_from_context(cr, uid, context=context)
-        if project_id:
+        project_ids = self._get_user_projects(cr, uid)
+        for project_id in project_ids:
             search_domain += ['|', ('project_ids', '=', project_id)]
         search_domain += [('id', 'in', ids)]
         # perform search
@@ -278,7 +281,7 @@
         'version_id': fields.many2one('project.issue.version', 'Version'),
         'stage_id': fields.many2one ('project.task.type', 'Stage',
                         track_visibility='onchange',
-                        domain="['&', ('fold', '=', False), ('project_ids', '=', project_id)]"),
+                        domain="[('project_ids', '=', project_id)]"),
         'project_id':fields.many2one('project.project', 'Project', track_visibility='onchange'),
         'duration': fields.float('Duration'),
         'task_id': fields.many2one('project.task', 'Task', domain="[('project_id','=',project_id)]"),

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : openerp-dev-gtk@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to