← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/6.0-opw-5267-project_mrp-ach into lp:openobject-addons/6.0

 

Anup(OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/6.0-opw-5267-project_mrp-ach into lp:openobject-addons/6.0.

Requested reviews:
  Jay Vora (OpenERP) (jvo-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-5267-project_mrp-ach/+merge/59732

Hello,

   The problem arise when OpenEPR creates automatically one or more task form a sale order, and this problem causes the error in the invoice. project_mrp installed and product configured as service,Make To Order and Produce.

To generate follow the steps below.

1. Create a sale order using the product "consultant", for an amount of 10 days at 500EUR per day
2. Confirm the sale order. OpenERP creates automatically a task with a planned time of 10 hours. Here is the problem: the task should be created with a planned time of 10 x 8 = 80 hours, or 10 days, but not for 10 hours!
3. Charge the task with the amount fo hours spent (for example 40 hours)
4. Create the invoice from the project (version 6) or from the analytic account (version 5). The amount of the invoice will be of 500EUR x 40 hours, instead of 500EUR x 5 days. Of course thi error depends from the initial error on the task.

Keep in mind that we must manage the sales orders and the invoices in days, while the time spent on project should be entry in hours.

The issue has been fixed by this.

Please share your views.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-5267-project_mrp-ach/+merge/59732
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/6.0-opw-5267-project_mrp-ach.
=== modified file 'project_mrp/project_procurement.py'
--- project_mrp/project_procurement.py	2011-01-14 00:11:01 +0000
+++ project_mrp/project_procurement.py	2011-05-03 06:21:07 +0000
@@ -33,10 +33,17 @@
         return True
 
     def action_produce_assign_service(self, cr, uid, ids, context=None):
+        task_obj = self.pool.get('project.task')
         for procurement in self.browse(cr, uid, ids, context=context):
             self.write(cr, uid, [procurement.id], {'state': 'running'})
             planned_hours = procurement.product_qty
-            task_id = self.pool.get('project.task').create(cr, uid, {
+            proj_uom = procurement.company_id.project_time_mode_id
+            if proj_uom and not proj_uom.name == procurement.product_uom.name:
+                if proj_uom.category_id == procurement.product_uom.category_id:
+                    planned_hours = procurement.product_qty * procurement.product_uom.factor_inv # Converting to the referring UoM
+                    planned_hours *= proj_uom.factor # Converting to the Project UoM
+            
+            task_id = task_obj.create(cr, uid, {
                 'name': '%s:%s' % (procurement.origin or '', procurement.name),
                 'date_deadline': procurement.date_planned,
                 'planned_hours':planned_hours,


Follow ups