[IMP] procurement: added a button to reset to confirmed a cancelled procurement
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>
Wed, 6 Nov 2013 08:32:31 +0000 (09:32 +0100)
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>
Wed, 6 Nov 2013 08:32:31 +0000 (09:32 +0100)
bzr revid: qdp-launchpad@openerp.com-20131106083231-jnr6w30rhfkvzsbu

addons/procurement/procurement.py
addons/procurement/procurement_view.xml

index cffb81b..a842a4d 100644 (file)
@@ -164,8 +164,10 @@ class procurement_order(osv.osv):
         return {}
 
     def cancel(self, cr, uid, ids, context=None):
-        self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
-        return True
+        return self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
+
+    def reset_to_confirmed(self, cr, uid, ids, context=None):
+        return self.write(cr, uid, ids, {'state': 'confirmed'}, context=context)
 
     def run(self, cr, uid, ids, context=None):
         for procurement in self.browse(cr, uid, ids, context=context):
index 51ef59e..610c728 100644 (file)
@@ -30,6 +30,7 @@
                         <button name="run" states="confirmed,exception" string="Run Procurement" class="oe_highlight" type="object"/>
                         <button name="check" states="running" string="Check Procurement" class="oe_highlight" type="object"/>
                         <button name="cancel" states="exception,confirmed,running" string="Cancel Procurement" type="object"/>
+                        <button name="reset_to_confirmed" states="cancel" string="Reconfirm Procurement" type="object"/>
                         <field name="state" readonly="1" widget="statusbar" statusbar_visible="draft,confirmed,running,done" />
                     </header>
                     <sheet>
@@ -83,7 +84,7 @@
             <field name="res_model">procurement.order</field>
             <field name="view_type">form</field>
             <field name="view_mode">tree,form</field>
-                       <field name="domain">[('group_id','=',active_id)]</field>                       
+            <field name="domain">[('group_id','=',active_id)]</field>            
         </record>
         
         <record id="procurement_group_form_view" model="ir.ui.view">
@@ -92,9 +93,9 @@
             <field name="arch" type="xml">
                 <form string="Procurement group" version="7.0">
                     <sheet>
-                                               <div class="oe_right oe_button_box">
-                                                       <button name="%(do_view_procurements)d" string="View related procurements" type="action" />
-                               </div>
+                        <div class="oe_right oe_button_box">
+                            <button name="%(do_view_procurements)d" string="View related procurements" type="action" />
+                        </div>
                         <group>
                             <field name="name"/>
                             <field name="move_type"/>