Anup(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-6172-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-6172-ach/+merge/65646

Hello,

  There were few issues with procurement workflow.

When MRP is not installed the procurement order for a product of type "Make to 
Order" and "Produce" is stuck in the exception state. It is not possible to 
cancel a procurement order though a button exist to cancel a procurement.

Now when a procurement is in cancel state it also needs to be brought to the 
draft state. This will be useful when you've manually created a procurement and 
you need to make some modifications.

This fixes the workflow of procurement.

Kindly share your views.

Thanks.

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-6172-ach/+merge/65646
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-6172-ach.
=== modified file 'procurement/procurement.py'
--- procurement/procurement.py	2011-03-10 09:52:41 +0000
+++ procurement/procurement.py	2011-06-23 12:09:40 +0000
@@ -152,6 +152,18 @@
             }
             return {'value': v}
         return {}
+    
+    def action_cancel_draft(self, cr, uid, ids, *args):
+        self.write(cr,uid,ids,{'state':'draft'})
+        wf_service = netsvc.LocalService("workflow")
+        for proc_id in ids:
+            # Deleting the existing instance of workflow for SO
+            wf_service.trg_delete(uid, 'procurement.order', proc_id, cr)
+            wf_service.trg_create(uid, 'procurement.order', proc_id, cr)
+        for (id,name) in self.name_get(cr, uid, ids):
+            message = _("The Procurement order '%s' has been set in draft state.") %(name,)
+            self.log(cr, uid, id, message)
+        return True
 
     def check_product(self, cr, uid, ids):
         """ Checks product type.

=== modified file 'procurement/procurement_view.xml'
--- procurement/procurement_view.xml	2011-01-17 13:55:22 +0000
+++ procurement/procurement_view.xml	2011-06-23 12:09:40 +0000
@@ -77,6 +77,7 @@
                             <button name="button_confirm" states="draft" string="Confirm" icon="gtk-apply"/>
                             <button name="button_restart" states="exception" string="Retry" icon="gtk-convert"/>
                             <button name="button_check" states="confirmed" string="Run Procurement" icon="gtk-media-play"/>
+                            <button name="action_cancel_draft" states="cancel" string="Set to Draft" icon="gtk-convert" type="object"/>
                         </group>
                     </page>
                     <page string="Extra Information">

=== modified file 'procurement/procurement_workflow.xml'
--- procurement/procurement_workflow.xml	2011-01-14 00:11:01 +0000
+++ procurement/procurement_workflow.xml	2011-06-23 12:09:40 +0000
@@ -163,6 +163,11 @@
             <field name="act_to" ref="act_produce_check"/>
             <field name="condition">check_produce()</field>
         </record>
+        <record id="trans_produce_check_cancel" model="workflow.transition">
+            <field name="act_from" ref="act_produce_check"/>
+            <field name="act_to" ref="act_cancel"/>
+            <field name="signal">button_cancel</field>
+        </record>
         <record id="trans_product_check_produce_service" model="workflow.transition">
             <field name="act_from" ref="act_produce_check"/>
             <field name="act_to" ref="act_produce_service"/>

_______________________________________________
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