diff --git a/addons/document_change/document_change.py b/addons/document_change/document_change.py
index 7dadacba952..e58c7e7e4d1 100644
--- a/addons/document_change/document_change.py
+++ b/addons/document_change/document_change.py
@@ -68,7 +68,7 @@ class doucment_change_process_phase(osv.osv):
'type': fields.selection([('control_required', 'Control Required'),('no_control', 'No Control')], 'Type'),
'date_control': fields.date('Control Date', select=True),
'phase_ids':fields.many2one('document.change.process.phase','Phase Type'),
- 'state': fields.selection([('draft', 'Draft'),('started', 'Started'),('validate', 'To Validate'), ('end', 'End')], 'Status', readonly=True),
+ 'state': fields.selection([('draft', 'Draft'),('started', 'Started'),('validate', 'To Validate'), ('done', 'Done')], 'Status',readonly=True),
'phase_document_ids':fields.many2many('ir.attachment','phase_document_rel','phase_id','document_id','Document'),
}
_defaults = {
@@ -76,6 +76,21 @@ class doucment_change_process_phase(osv.osv):
'update_document': lambda *a:'at_endPhase',
'type':lambda *a: 'no_control',
}
+ def state_draft_set(self, cr, uid, ids, *args):
+ self.write(cr, uid, ids, {'state':'draft'})
+ return True
+
+ def state_validate_set(self, cr, uid, ids, *args):
+ self.write(cr, uid, ids, {'state':'validate'})
+ return True
+ def state_started_set(self, cr, uid, ids, *args):
+ self.write(cr, uid, ids, {'state':'started'})
+ return True
+
+ def state_done_set(self, cr, uid, ids, *args):
+ self.write(cr, uid, ids, {'state':'done'})
+ return True
+
doucment_change_process_phase()
class document_change_process_model(osv.osv):
@@ -95,32 +110,29 @@ class document_file(osv.osv):
_columns = {
'type_id':fields.many2one('document.change.type','Document Type'),
- 'state': fields.selection([('change_request', 'Change Request'),('change_proposed', 'Change Proposed'), ('in_production', 'In Production'), ('to_update', 'To Update'), ('validate', 'To Validate'), ('cancel', 'Cancel')], 'Status',readonly=True),
+ 'state': fields.selection([('change_request', 'Change Request'),('change_proposed', 'Change Proposed'), ('in_production', 'In Production'), ('to_update', 'To Update'), ('validate', 'To Validate'), ('cancel', 'Cancel')], 'Status'),
'target_document_id': fields.many2one('document.directory', 'Target Document'),
'target':fields.binary('Target'),
}
_defaults = {
'state': lambda *a: 'change_request',
}
- def button_change_request(self, cr, uid, ids, context={}):
- self.write(cr, uid, ids, {'state':'change_request'})
+ def state_set_request(self, cr, uid, ids, context={}):
+ self.write(cr, uid, ids, {'state':'change_request'},context=context)
return True
- def button_change_proposed(self, cr, uid, ids, context={}):
- self.write(cr, uid, ids, {'state':'change_proposed'})
+ def state_set_proposed(self, cr, uid, ids, context={}):
+ self.write(cr, uid, ids, {'state':'change_proposed'},context=context)
return True
- def button_in_production(self, cr, uid, ids, context={}):
+ def state_set_in_production(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state':'in_production'})
return True
- def button_update(self, cr, uid, ids, context={}):
+ def state_set_update(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state':'to_update'})
return True
- def button_change_validated(self, cr, uid, ids, context={}):
- self.write(cr, uid, ids, {'state':'validate'})
+ def state_set_validated(self, cr, uid, ids, context={}):
+ self.write(cr, uid, ids, {'state':'validate'},context=context)
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)
+ def state_set_cancel(self, cr, uid, ids, context={}):
return self.write(cr, uid, ids, {'state':'cancel'},context=context)
document_file()
diff --git a/addons/document_change/document_change_view.xml b/addons/document_change/document_change_view.xml
index b5f6f5862bd..90bcf2b5024 100644
--- a/addons/document_change/document_change_view.xml
+++ b/addons/document_change/document_change_view.xml
@@ -234,10 +234,10 @@
-
-
+
+
-
+
@@ -343,7 +343,7 @@
-
+
diff --git a/addons/document_change/document_change_workflow.xml b/addons/document_change/document_change_workflow.xml
index 25ddfd9293d..0c74d95d254 100644
--- a/addons/document_change/document_change_workflow.xml
+++ b/addons/document_change/document_change_workflow.xml
@@ -1,7 +1,7 @@
-
+
ir.attachment.basic
ir.attachment
True
@@ -9,32 +9,32 @@
-
+
True
- change_requested
+ state_set_request
-
- change proposed
- button_change_proposed()
+
+ change_proposed
+ state_set_proposed()
function
-
- to update
- button_update()
+
+ to_update
+ state_set_update()
function
-
- in production
- button_in_production()
+
+ in_production
+ state_set_in_production()
function
-
+
cancel
- button_cancel()
+ state_set_cancel()
function
@@ -63,12 +63,12 @@
- request
+ button_change_request
- button_to_update
+ button_update
diff --git a/addons/document_change/document_phase_workflow.xml b/addons/document_change/document_phase_workflow.xml
index cae35c46269..73244ee741e 100644
--- a/addons/document_change/document_phase_workflow.xml
+++ b/addons/document_change/document_phase_workflow.xml
@@ -1,7 +1,7 @@
-
+
document.change.process.phase.basic
document.change.process.phase
True
@@ -9,26 +9,26 @@
-
+
True
draft
-
+
started
- button_start()
+ state_started_set()
function
-
- to validate
- button_done()
+
+ validate
+ state_validate_set()
function
-
+
end
- button_end()
+ state_done_set()
function
@@ -41,7 +41,7 @@
- button_done
+ button_validate
diff --git a/addons/document_change/document_process_workflow.xml b/addons/document_change/document_process_workflow.xml
index 207c6cc3669..26cb6574d89 100644
--- a/addons/document_change/document_process_workflow.xml
+++ b/addons/document_change/document_process_workflow.xml
@@ -1,7 +1,7 @@
-
+
document.change.process.phase.basic
document.change.process.phase
True
@@ -9,30 +9,30 @@
-
+
True
draft
-
+
in_progress
button_in_progress()
function
-
+
pending
- button_pending()
+ state_pending_set()
function
-
- to validate
- button_done()
+
+ to_validate
+ state_done_set()
function
-
+
done
button_end()
function
@@ -42,27 +42,27 @@
- button_in_progress
+ in_progress
- button_pending
+ pending
- button_in_progress
+ in_progress
- button_validate
+ validate
- button_done
+ done
\ No newline at end of file