[6.0][project_long_term] Signature error for _compute function

Bug #655316 reported by Vianney - www.akretion.com.br
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Opinion
Undecided
OpenERP Services Experts

Bug Description

the function _compute, defined like this in project_long_term.py (line 95 in last revision):
    def _compute(self, cr, uid, ids, context=None):
Raise an error because it is called from a fields.function which needs a signature like :
    def _compute(self, cr, uid, ids, field_name, arg, context=None):

This error is reproductible only if asking for the field total_hours because it is not displayed right now.

Related branches

Revision history for this message
Vianney - www.akretion.com.br (vianneydc) wrote :

Actually the definition of the function is wrong because even the res dictionary returned by the function is wrong.

Here comes a patch which solves the problem.

(Remembering that the problem is hidden because right now the function is never called because the total_hours field is not displayed in the view. By the way, it is a very interesting field!)

Revision history for this message
Vianney - www.akretion.com.br (vianneydc) wrote :

Actually I think it can be very useful to add the field total_hours and duration both in tree and form view and I suggest to do it like it the patch attached.

I changed the name displayed of the field, too because Total hours already is used for the total worked hours where this field is the total of planned hours.

In the patch attached, there is the solution for the bug itself and to add those fields in the form and tree view. I suggest to do that as I think it was forgotten.

security vulnerability: yes → no
visibility: private → public
summary: - [6.0][project_long_term] Signature error for _compute fonction
+ [6.0][project_long_term] Signature error for _compute function
Revision history for this message
Anup(SerpentCS) (anup-serpent) wrote :

Hello Vianney,

     It has been fixed by revision 4235 <email address hidden>

Thanks for pointing out the hidden issue.

Changed in openobject-addons:
milestone: none → 6.0
status: New → Fix Released
Changed in openobject-addons:
status: Fix Released → Confirmed
Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

Hello RME and Anup,

The patch you apply partially fixes the problem. However I would like to emphasis 2 remaining issues:

1) you didn't add the 'total_hours' field in the phase tree view. I think this is helpful, along with the phase duration (duration is different from the load or 'total_hours' field as duration result from both the load and the resource you use), so both duration and 'total_hours' are useful to see in the tree view.

2) there is a wording issue with the 'total_hours' field. Indeed in a task: there is already the 'planned_hours field' and the 'total_hours' field which is the sum of the hours worked upon that task.
However, in a phase you call the sum of the planned hours 'total_hours' which lead to confusion as one would believe it's the sum of worked hours, just like for tasks. I think it's better to rename that field 'planned_hours' instead. It's up to you if you want to create a 'worked_hours' aggregate at the phase level or not.

Please think to fix that wording before the version freeze, else it will generate much bigger issues/confusion later. I required the comments from the server expert team here.

Regards

Changed in openobject-addons:
assignee: nobody → OpenERP Services Experts (openerp-expert-service)
Changed in openobject-addons:
status: Confirmed → Triaged
status: Triaged → Opinion
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.