Review: Needs Fixing

Functionally it's fine, but I have some remarks.

0. More than 150 commits without a decent commit message is a shame.  You have 
to find something more informative than "[IMP]"!

1. Choose better field names (the ones you chose aren't helpful):
    task            -> use_tasks    (indicates whether the project uses tasks)
    open_task       -> task_count   (counts the number of tasks)
    issues          -> use_issues
    total_issues    -> issue_count
    phases          -> use_phases
    open_phases     -> phase_count
    timesheets      -> use_timesheets
    total_timesheet -> timesheet_count

2. Make the field 'company_uom_id' a fields.related('company_id', 
'project_time_mode_id', type='many2one', relation='product.uom').  The simpler 
the better.  In the kanban view, simply use <field name="company_uom_id"/> to 
display the unit (in the right language).  Also don't bother with plurals (the 
extra 's'), as it is not portable across translations!

3. The method that counts the number of tasks makes one query per project 
(search inside a loop).  The following version makes a constant number of 
queries (search + browse), and is therefore more scalable:

    def _task_count(self, cr, uid, ids, field_name, arg, context=None):
        res = dict.fromkeys(ids, 0)
        task_ids = self.pool.get('project.task').search(cr, uid, 
[('project_id', 'in', ids)])
        for task in self.pool.get('project.task').browse(cr, uid, task_ids, 
context):
            res[task.project_id.id] += 1
        return res

Same remark for counting issues, phases and timesheets.

4. You don't need a method like 'open_tasks' to open a view.  Use a relate 
action like 'project.act_project_project_2_project_task_all' instead (easier to 
configure and maintain).  Please remove the default value for 'project_id' at 
line 113 of diff.  The action sets a correct default value for it.

Same remark for issues, phases and timesheets.

5. In the kanban view, please don't hardcode the date format.  Simply use 
<field name="date"/>, and let the web client format it correctly.

6. Wouldn't it be simpler to reuse existing stuff for editing and changing the 
colors, like below?  Deleting a project from its kanban view is not useful, 
IMHO.  I think that two small icons in a corner wouldn't look bad.

    <a string="Edit" icon="gtk-edit" type="edit"/>
    <a string="Change Color" icon="color-picker" type="color" name="color"/>


Thanks,
Raphael

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-project-gallery-apa/+merge/104092
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-project-gallery-apa.

_______________________________________________
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