project_timesheet User's product for the analytic account is not taken into consideration

Bug #415535 reported by Open Net Sàrl
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Invalid
Undecided
Unassigned

Bug Description

If you use the timesheet ans configure a default product for the employee as well as a User's product for a specific analytic account. When the user, related to the employee, fill the timesheet, the product use for the valuation is the product selected at the analytic account level (if not defined, the product related to the employee is used).

If the employee report a work done on a project linked to an analytic account that use a specific product for this employee, this product is not take into account and the product, directly linked to the employee is used.

I propose that:
- If the project is linked to an analytic account, the the value of the 'User's Product for this Analytic Account' is used for the timesheet valuation
- If the project is not linked to an analytic account, or the analytic account has no 'User's Product for this Analytic Account', then the product related to the employee is used.

This will correct the current status where, if the employee has entries from work done on project as well as direct entries in the timesheet, the timesheet display, for the same analytic account different product valuation.

Revision history for this message
Ferdinand (office-chricar) wrote :

I agree, and IMHO the functionality is lost since migration to 5.x

Changed in openobject-addons:
assignee: nobody → vra (openerp) (vra-openerp)
Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) wrote :

hello,

Can you provide me more information with example?

thanks.

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello,

I couldn't get the term ''User's Product for this Analytic Account''.

Would you please be more clear?

Thanks.

Changed in openobject-addons:
assignee: vra (openerp) (vra-openerp) → nobody
Changed in openobject-addons:
assignee: nobody → mtr(OpenERP) (mtr-openerp)
Revision history for this message
Pascal Gallard (pmail-lp) wrote :

Hello,

I think I have the same kind of issue.

I think "User's Product for this Analytic Account" means the "Users/Products Rel." available in an "Analytic account".

How to reproduce the issue ?
(installed modules: hr_*, project_* among others, from the regular 5.0.7 set of modules)

1. Create 2 products (with differents cost and sale prices) P1 and P2 ;
2. Create an employee E and link P1 to this employee (timesheet tab in the employee form) ;
3. Create an "Analytic account" AC and link the employee to P2 ("Users/Products Rel." tab in the "analytic account" form) ;
4. Create a project and link the project to the "Analytic account" AC ;
5. Create a task (in the project)
6. Add some hours in the "task work" part (done by E)
7. Finally, check the corresponding employee's timesheet. The total amount is "nb hours" * "price of P1" instead of "nb hours" * "price of P2"

By the way, if you add manually some hours directly in the timesheet and if you give directly the "analytic account" AC, you will get the right amount ("nb hours" * "price of P2").

At least, in all cases, I think that the total amount should be defined regardless the way your time is defined (directly in the timesheet, or in the task/project management form)

Hope this is clear enough.

Regards,
Pascal

Revision history for this message
Pascal Gallard (pmail-lp) wrote :

Hello,

as a quick fix:
--- a/addons/project_timesheet/project_timesheet.py
+++ b/addons/project_timesheet/project_timesheet.py
@@ -72,7 +72,7 @@ class project_work(osv.osv):
         vals_line['unit_amount'] = vals['hours']
         acc_id = obj_task.project_id.category_id.id
         vals_line['account_id'] = acc_id
- res = obj.on_change_account_id(cr, uid, False, acc_id)
+ res = obj.on_change_account_id(cr, uid, False, acc_id, vals['user_id'])
         if res.get('value'):
             vals_line.update(res['value'])
         vals_line['general_account_id'] = result['general_account_id']

The real question is:
In the method hr_analytic_timesheet.on_change_account_id (1), when the user_id param is not defined, why does not it try to get the corresponding employe id. I mean that we have uid (and no user_id), may be someone (in this method or parent class method) should check if there is a linked employed id.

(1) addons/analytic_user_function/analytic_user_function.py

By the way, I have no knowledge in Python and may be I'm completely wrong.

Regards,
Pascal

Changed in openobject-addons:
assignee: mtr(OpenERP) (mtr-openerp) → JMA(Open ERP) (jma-openerp)
importance: Undecided → Low
milestone: none → 5.0.9
status: Incomplete → Confirmed
Changed in openobject-addons:
milestone: 5.0.9 → 5.0.10
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Pascal,
I've looked into this issue and this is not a simpler one.
The facility you ask is, consider a product from Analytic account (if supplied),not the user's related product.

I agree with this, but the modules project_timesheet and analytic_user_function are not related to each other in any sense.

Better, you make the dependancy of analytic_user_function on project_timesheet.(i.e. add project_timesheet into depends tab ).
Override the get_user_related_details() or create/write, and achieve the goal.

I am escalating this to a newer milestone as this change needs some discussions to be made.

Thanks.

Changed in openobject-addons:
milestone: 5.0.10 → 5.0.11
status: In Progress → Confirmed
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

May need to create a new module to act as a bridge between project_timesheet and analytic_user_function.

Changed in openobject-addons:
assignee: JMA(Open ERP) (jma-openerp) → nobody
milestone: 5.0.11 → none
Changed in openobject-addons:
status: Confirmed → Triaged
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello,

I have tested your scenario with stable 5.0.15. But everything is working fine, so please try with latest code. Let's close this bug for now, for the sake of clarity in Launchpad.

Thanks.

Changed in openobject-addons:
importance: Low → Undecided
status: Triaged → Invalid
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.