diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php
index f9901feb7bd7109e60cef4508692a179225cf467..9cf6604ce9b707aa5be1ef9b0ccb3634ea873a54 100644
--- a/dev/skeletons/modMyModule.class.php
+++ b/dev/skeletons/modMyModule.class.php
@@ -81,6 +81,7 @@ class modMyModule extends DolibarrModules
 		//							'models' => 0,                                   // Set this to 1 if module has its own models directory
 		//							'css' => '/mymodule/css/mymodule.css.php',       // Set this to relative path of css if module has its own css file
 		//							'hooks' => array('hookcontext1','hookcontext2')  // Set here all hooks context managed by module
+		//							'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) // Set here all workflow context managed by module
 		//                        );
 		$this->module_parts = array();
 
diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php
index 00775ed3070e53af35f372f5acaf46450b3b4089..2132a05992652eacafcec232ddcaf83cb6d32a74 100755
--- a/htdocs/admin/workflow.php
+++ b/htdocs/admin/workflow.php
@@ -77,10 +77,36 @@ print "</tr>\n";
 clearstatcache();
 
 $workflowcodes=array();
-if ($conf->propal->enabled && $conf->commande->enabled) $workflowcodes['WORKFLOW_PROPAL_AUTOCREATE_ORDER']='WORKFLOW_PROPAL_AUTOCREATE_ORDER';
-//if ($conf->propal->enabled && $conf->facture->enabled)  $workflowcodes['WORKFLOW_PROPAL_AUTOCREATE_INVOICE']='WORKFLOW_PROPAL_AUTOCREATE_INVOICE';
-//if ($conf->contrat->enabled && $conf->facture->enabled)  $workflowcodes['WORKFLOW_CONTRACT_AUTOCREATE_INVOICE']='WORKFLOW_CONTRACT_AUTOCREATE_INVOICE';
-if ($conf->commande->enabled && $conf->facture->enabled) $workflowcodes['WORKFLOW_ORDER_AUTOCREATE_INVOICE']='WORKFLOW_ORDER_AUTOCREATE_INVOICE';
+$workflow=array(
+		'order' => array(
+				'propal' => array('WORKFLOW_PROPAL_AUTOCREATE_ORDER')
+		),
+		'invoice' => array (
+				'order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')
+				//,'contract' => array('WORKFLOW_CONTRACT_AUTOCREATE_INVOICE')
+				//, 'propal' => array('WORKFLOW_PROPAL_AUTOCREATE_INVOICE')
+		)
+);
+$workflow = array_merge($workflow, $conf->modules_parts['workflow']);
+
+foreach($workflow as $child => $parents)
+{
+	if ($conf->$child->enabled)
+	{
+		$langs->Load($child.'@'.$child);
+		
+		foreach($parents as $parent => $actions)
+		{
+			if ($conf->$parent->enabled)
+			{
+				foreach($actions as $action)
+				{
+					$workflowcodes[$action] = $action;
+				}
+			}
+		}
+	}
+}
 
 if (count($workflowcodes) > 0)
 {
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 71cabf3f68d768d9d31a784a90a4380f7f1a8261..3f1e3bf94a6febf5bdaf3e2811261b0b4a1f72d4 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -401,6 +401,9 @@ class Conf
 
 		// For backward compatibility
 		$this->produit=$this->product;
+		$this->invoice=$this->facture;
+		$this->order=$this->commande;
+		$this->contract=$this->contrat;
 
 
         // Define menu manager in setup
diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php
index f2cff18723326040f734b756e1f5261673ad4589..e1b1d128e2d33bad31d3cdc4ac5e0b9e6239b122 100644
--- a/htdocs/core/modules/modWorkflow.class.php
+++ b/htdocs/core/modules/modWorkflow.class.php
@@ -69,7 +69,7 @@ class modWorkflow extends DolibarrModules
         $this->dirs = array("/workflow/temp");
 
         // Config pages. Put here list of php page names stored in admmin directory used to setup module.
-        $this->config_page_url = 'workflow.php';
+        $this->config_page_url = array('workflow.php');
 
         // Dependencies
         $this->depends = array();       // List of modules id that must be enabled if this module is enabled