document_change: Add the action of docuement workflow
authorsbh (Open ERP) <sbh@tinyerp.com>
Fri, 22 Jan 2010 05:59:09 +0000 (11:29 +0530)
committersbh (Open ERP) <sbh@tinyerp.com>
Fri, 22 Jan 2010 05:59:09 +0000 (11:29 +0530)
bzr revid: sbh@tinyerp.com-20100122055909-iybm50kgj5rtawc9

addons/document_change/document_change.py

index 0b24828..3de8f5e 100644 (file)
@@ -102,6 +102,30 @@ class document_file(osv.osv):
     _defaults = {      
      'state': lambda *a: 'validate',
      }    
+    def button_change_request(self, cr, uid, ids, context={}):
+        for document in self.browse(cr, uid, ids, context):
+            if document.target_document_id:
+                self.write(cr, uid, ids, {'state':'change_proposed'})
+            else:
+                self.write(cr, uid, ids, {'state':'change_request'})                
+        return True
+    def button_change_proposed(self, cr, uid, ids, context={}):
+        self.write(cr, uid, ids, {'state':'change_proposed'})        
+        return True              
+    def button_in_production(self, cr, uid, ids, context={}):
+        self.write(cr, uid, ids, {'state':'in_production'})
+        return True
+    def button_to_update(self, cr, uid, ids, context={}):
+#        for document in self.browse(cr, uid, ids, context):
+#            if document.target_document_id:        
+        self.write(cr, uid, ids, {'state':'to_update'})
+        return True                
+    def button_cancel(self, cr, uid, ids, context={}):
+        workflow = netsvc.LocalService('workflow')
+        for oid in ids:
+            workflow.trg_create(uid, self._name, oid, cr)
+        return self.write(cr, uid, ids, {'state':'to_cancel'},context=context)        
+        
 document_file()
 
 class document_change_process_type(osv.osv):