diff --git a/ChangeLog b/ChangeLog
index 31ddbd56bddfc7d8f2697712a32e317ce944cc84..3eb284ccc801e261191dc9927af1303d7facfb7d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,7 +13,9 @@ Following changes may create regression for some external modules, but were nece
 * The page compta/facture.php was renamed into compta/facture/card.php to match page naming conventions.
 * The signature of method ->delete() of class Product and PriceExpression was changed from 
   ->delete($id, notrigger) to ->delete(User, notrigger) to match standard dev rules.
-
+* Removed CommonObject::displayMarginInfos (was deprecated in 3.8). Use same method into
+  html.formmargin.class.php
+* Removed Societe::set_commnucation_level (was deprecated in 4.0). Was not used.
 
 ***** ChangeLog for 5.0.1 compared to 5.0.0 *****
 FIX: #6503: SQL error in "Last pending payment invoices"
diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php
index 3c3aa6aef88b626c1a6eec99d1034333a26f9f6d..3e9e5a1205d589d8e9c2d328ccdc6e94899ffec4 100644
--- a/htdocs/comm/propal/contact.php
+++ b/htdocs/comm/propal/contact.php
@@ -130,12 +130,12 @@ else if ($action == 'deletecontact' && $user->rights->propale->creer)
 		dol_print_error($db);
 	}
 }
-
+/*
 else if ($action == 'setaddress' && $user->rights->propale->creer)
 {
 	$result=$object->setDeliveryAddress($_POST['fk_address']);
 	if ($result < 0) dol_print_error($db,$object->error);
-}
+}*/
 
 
 /*
diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php
index bc257f3ac0558391f7c7ef4604491b7ee1756c44..fe37a630c5dbd3be130d3f35b0d06bc108d30812 100644
--- a/htdocs/commande/contact.php
+++ b/htdocs/commande/contact.php
@@ -107,13 +107,14 @@ else if ($action == 'deletecontact' && $user->rights->commande->creer)
 		dol_print_error($db);
 	}
 }
-
+/*
 else if ($action == 'setaddress' && $user->rights->commande->creer)
 {
 	$object->fetch($id);
 	$result=$object->setDeliveryAddress($_POST['fk_address']);
 	if ($result < 0) dol_print_error($db,$object->error);
-}
+}*/
+
 
 /*
  * View
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index e03db1b4773fb39679fcb0e0d9f524faf28aec50..2526638cee592c259d4028df048321e9a7c0ff2a 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -238,6 +238,7 @@ abstract class CommonObject
 
 	/**
 	 * @var int Delivery address ID
+	 * @deprecated
 	 * @see setDeliveryAddress()
 	 */
 	public $fk_delivery_address;
@@ -1623,7 +1624,8 @@ abstract class CommonObject
 
     /**
      *	Define delivery address
-     *
+     *  @deprecated
+     *  
      *	@param      int		$id		Address id
      *	@return     int				<0 si ko, >0 si ok
      */
@@ -3223,51 +3225,14 @@ abstract class CommonObject
 
     /**
      *  Return if a country is inside the EEC (European Economic Community)
-     *  TODO Add a field into dictionary
+     *  @deprecated
      *
      *  @return     boolean		true = country inside EEC, false = country outside EEC
      */
     function isInEEC()
     {
-        // List of all country codes that are in europe for european vat rules
-        // List found on http://ec.europa.eu/taxation_customs/common/faq/faq_1179_en.htm#9
-        $country_code_in_EEC=array(
-    			'AT',	// Austria
-    			'BE',	// Belgium
-    			'BG',	// Bulgaria
-    			'CY',	// Cyprus
-    			'CZ',	// Czech republic
-    			'DE',	// Germany
-    			'DK',	// Danemark
-    			'EE',	// Estonia
-    			'ES',	// Spain
-    			'FI',	// Finland
-    			'FR',	// France
-    			'GB',	// United Kingdom
-    			'GR',	// Greece
-    			'HR',   // Croatia
-                'NL',	// Holland
-    			'HU',	// Hungary
-    			'IE',	// Ireland
-    			'IM',	// Isle of Man - Included in UK
-    			'IT',	// Italy
-    			'LT',	// Lithuania
-    			'LU',	// Luxembourg
-    			'LV',	// Latvia
-    			'MC',	// Monaco - Included in France
-    			'MT',	// Malta
-                //'NO',	// Norway
-    			'PL',	// Poland
-    			'PT',	// Portugal
-    			'RO',	// Romania
-    			'SE',	// Sweden
-    			'SK',	// Slovakia
-    			'SI',	// Slovenia
-    			'UK',	// United Kingdom
-        //'CH',	// Switzerland - No. Swizerland in not in EEC
-        );
-        //print "dd".$this->country_code;
-        return in_array($this->country_code,$country_code_in_EEC);
+        require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+        return isInEEC($this);
     }
 
 
@@ -3754,21 +3719,6 @@ abstract class CommonObject
     }
 
 
-	/**
-	 * Show the array with all margin infos
-	 *
-	 * @param 		bool	$force_price	Force price
-	 * @return		void
-	 * @deprecated	3.8 Load FormMargin class and make a direct call to displayMarginInfos
-	 */
-	function displayMarginInfos($force_price=false)
-	{
-		include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
-		$formmargin=new FormMargin($this->db);
-		$formmargin->displayMarginInfos($this, $force_price);
-	}
-
-
 	/**
 	 *	Add resources to the current object : add entry into llx_element_resources
 	 *	Need $this->element & $this->id
@@ -4711,4 +4661,61 @@ abstract class CommonObject
 		}
 		return $buyPrice;
 	}
+	
+	
+
+	/**
+	 * Create object into database
+	 *
+	 * @param  User $user      User that creates
+	 * @param  bool $notrigger false=launch triggers after, true=disable triggers
+	 *
+	 * @return int <0 if KO, Id of created object if OK
+	 */
+	public function createCommon(User $user, $notrigger = false)
+	{
+	    
+	}
+	
+	
+	/**
+	 * Load object in memory from the database
+	 *
+	 * @param int    $id  Id object
+	 * @param string $ref Ref
+	 *
+	 * @return int <0 if KO, 0 if not found, >0 if OK
+	 */
+	public function fetchCommon($id, $ref = null)
+	{
+	    
+	}
+	
+
+	/**
+	 * Update object into database
+	 *
+	 * @param  User $user      User that modifies
+	 * @param  bool $notrigger false=launch triggers after, true=disable triggers
+	 *
+	 * @return int <0 if KO, >0 if OK
+	 */
+	public function updateCommon(User $user, $notrigger = false)
+	{
+	    
+	}
+	
+	
+	/**
+	 * Delete object in database
+	 *
+	 * @param User $user      User that deletes
+	 * @param bool $notrigger false=launch triggers after, true=disable triggers
+	 *
+	 * @return int <0 if KO, >0 if OK
+	 */
+	public function deleteCommon(User $user, $notrigger = false)
+	{
+	    
+	}
 }
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 809a045bacffee3634982e52263bc4c175eb6ae1..6847cd7b9c2b7e61339c9ce5455e7a926d1bf635 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -496,6 +496,55 @@ function getFormeJuridiqueLabel($code)
     }
 }
 
+/**
+ *  Return if a country is inside the EEC (European Economic Community)
+ *  TODO Add a field into country dictionary.
+ *  
+ *  @param      Object      $object    Object
+ *  @return     boolean		           true = country inside EEC, false = country outside EEC
+ */
+function isInEEC($object)
+{
+    // List of all country codes that are in europe for european vat rules
+    // List found on http://ec.europa.eu/taxation_customs/common/faq/faq_1179_en.htm#9
+    $country_code_in_EEC=array(
+        'AT',	// Austria
+        'BE',	// Belgium
+        'BG',	// Bulgaria
+        'CY',	// Cyprus
+        'CZ',	// Czech republic
+        'DE',	// Germany
+        'DK',	// Danemark
+        'EE',	// Estonia
+        'ES',	// Spain
+        'FI',	// Finland
+        'FR',	// France
+        'GB',	// United Kingdom
+        'GR',	// Greece
+        'HR',   // Croatia
+        'NL',	// Holland
+        'HU',	// Hungary
+        'IE',	// Ireland
+        'IM',	// Isle of Man - Included in UK
+        'IT',	// Italy
+        'LT',	// Lithuania
+        'LU',	// Luxembourg
+        'LV',	// Latvia
+        'MC',	// Monaco - Included in France
+        'MT',	// Malta
+        //'NO',	// Norway
+        'PL',	// Poland
+        'PT',	// Portugal
+        'RO',	// Romania
+        'SE',	// Sweden
+        'SK',	// Slovakia
+        'SI',	// Slovenia
+        'UK',	// United Kingdom
+        //'CH',	// Switzerland - No. Swizerland in not in EEC
+    );
+    //print "dd".$this->country_code;
+    return in_array($object->country_code, $country_code_in_EEC);
+}
 
 
 /**
diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php
index 1354b3d49f11dcad76b66f8bd64107a0665b2bf8..7c721d7cf471b5cea02bff96e320c877299ff06d 100644
--- a/htdocs/expedition/contact.php
+++ b/htdocs/expedition/contact.php
@@ -123,13 +123,13 @@ else if ($action == 'deletecontact' && $user->rights->expedition->creer)
 		dol_print_error($db);
 	}
 }
-
+/*
 else if ($action == 'setaddress' && $user->rights->expedition->creer)
 {
 	$object->fetch($id);
 	$result=$object->setDeliveryAddress($_POST['fk_address']);
 	if ($result < 0) dol_print_error($db,$object->error);
-}
+}*/
 
 
 /*
diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php
index 57ad04a8a1a39396b1ca18380b1bf17afbdad4d3..ede1cc6bec964a90c8c4c74a1fea490c501f4075 100644
--- a/htdocs/expedition/shipment.php
+++ b/htdocs/expedition/shipment.php
@@ -113,7 +113,7 @@ if (empty($reshook))
     	if ($result < 0)
     		setEventMessages($object->error, $object->errors, 'errors');
     }
-    
+    /*
     if ($action == 'setdeliveryaddress' && $user->rights->commande->creer)
     {
     	$object = new Commande($db);
@@ -122,7 +122,7 @@ if (empty($reshook))
     	if ($result < 0)
     		setEventMessages($object->error, $object->errors, 'errors');
     }
-    
+    */
     if ($action == 'setmode' && $user->rights->commande->creer)
     {
     	$object = new Commande($db);
diff --git a/htdocs/modulebuilder/skeletons/skeleton_class.class.php b/htdocs/modulebuilder/skeletons/skeleton_class.class.php
index 01b48c35f75d2c41a535adb49270372218c50e4a..6805a6970436546eef1cf84f72aa94cde9b64d79 100644
--- a/htdocs/modulebuilder/skeletons/skeleton_class.class.php
+++ b/htdocs/modulebuilder/skeletons/skeleton_class.class.php
@@ -1,5 +1,5 @@
 <?php
-/* Copyright (C) 2007-2012  Laurent Destailleur <eldy@users.sourceforge.net>
+/* Copyright (C) 2007-2017  Laurent Destailleur <eldy@users.sourceforge.net>
  * Copyright (C) 2014-2016  Juanjo Menent       <jmenent@2byte.es>
  * Copyright (C) 2015       Florian Henry       <florian.henry@open-concept.pro>
  * Copyright (C) 2015       Raphaƫl Doursenaud  <rdoursenaud@gpcsolutions.fr>
@@ -20,10 +20,9 @@
  */
 
 /**
- * \file    dev/skeletons/skeleton_class.class.php
- * \ingroup mymodule othermodule1 othermodule2
- * \brief   This file is an example for a CRUD class file (Create/Read/Update/Delete)
- *          Put some comments here
+ * \file        modulebuilder/skeletons/skeleton_class.class.php
+ * \ingroup     mymodule othermodule1 othermodule2
+ * \brief       This file is an example for a CRUD class file (Create/Read/Update/Delete)
  */
 
 // Put here all includes required by your class file
@@ -34,26 +33,27 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
 /**
  * Class Skeleton_Class
  *
- * Put here description of your class
- *
- * @see CommonObject
+ * Put here description of your class.
  */
 class Skeleton_Class extends CommonObject
 {
 	/**
-	 * @var string Id to identify managed objects
+	 * @var string Id to identify managed object
 	 */
 	public $element = 'skeleton';
 	/**
 	 * @var string Name of table without prefix where object is stored
 	 */
 	public $table_element = 'skeleton';
-
-	/**
-	 * @var Skeleton_ClassLine[] Lines
-	 */
-	public $lines = array();
-
+    /**
+     * @var array Array with all fields and their property
+     */
+	public $picto = 'generic';
+    /**
+     * @var array Array with all fields and their property
+     */
+	public $fields;
+	
 	/**
 	 * @var mixed Sample property 1
 	 */
@@ -62,8 +62,21 @@ class Skeleton_Class extends CommonObject
 	 * @var mixed Sample property 2
 	 */
 	public $prop2;
+	
 	//...
-
+	
+	protected $ismultientitymanaged = 1;	// 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
+	
+	public $table_element_line = 'skeletondet';
+    public $class_element_line = 'SkeletonLine';
+    public $fk_element = 'fk_skeleton';
+    /**
+	 * @var Skeleton_ClassLine[] Lines
+	 */
+	public $lines = array();
+	
+	
+	
 	/**
 	 * Constructor
 	 *
@@ -289,10 +302,10 @@ class Skeleton_Class extends CommonObject
 	 */
 	public function update(User $user, $notrigger = false)
 	{
-		$error = 0;
-
 		dol_syslog(__METHOD__, LOG_DEBUG);
 
+		$error = 0;
+		
 		// Clean parameters
 		if (isset($this->prop1)) {
 			$this->prop1 = trim($this->prop1);
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 536bcece10fadb2723c37eb17ae5a307d2ed44a5..71f7cd8e7f631a0bfee1447c3975eb91bad92cb9 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -1801,60 +1801,61 @@ if (($action == 'clone' && (empty($conf->use_javascript_ajax) || ! empty($conf->
 /* Barre d'action                                                             */
 /*                                                                            */
 /* ************************************************************************** */
-
-print "\n".'<div class="tabsAction">'."\n";
-
-$parameters=array();
-$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action);    // Note that $action and $object may have been modified by hook
-if (empty($reshook))
+if ($action != 'create' && $action != 'edit')
 {
-    if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer ) || 
-       ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer))
+    print "\n".'<div class="tabsAction">'."\n";
+    
+    $parameters=array();
+    $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action);    // Note that $action and $object may have been modified by hook
+    if (empty($reshook))
     {
-        if (! isset($object->no_button_edit) || $object->no_button_edit <> 1) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
-
-        if (! isset($object->no_button_copy) || $object->no_button_copy <> 1)
+        if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer ) || 
+           ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer))
         {
-            if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))
+            if (! isset($object->no_button_edit) || $object->no_button_edit <> 1) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
+    
+            if (! isset($object->no_button_copy) || $object->no_button_copy <> 1)
             {
-                print '<div class="inline-block divButAction"><span id="action-clone" class="butAction">'.$langs->trans('ToClone').'</span></div>'."\n";
-            }
-            else
-			{
-                print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=clone&amp;id='.$object->id.'">'.$langs->trans("ToClone").'</a></div>';
+                if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))
+                {
+                    print '<div class="inline-block divButAction"><span id="action-clone" class="butAction">'.$langs->trans('ToClone').'</span></div>'."\n";
+                }
+                else
+    			{
+                    print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=clone&amp;id='.$object->id.'">'.$langs->trans("ToClone").'</a></div>';
+                }
             }
         }
-    }
-    $object_is_used = $object->isObjectUsed($object->id);
-
-    if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->supprimer)
-    || ($object->type == Product::TYPE_SERVICE && $user->rights->service->supprimer))
-    {
-        if (empty($object_is_used) && (! isset($object->no_button_delete) || $object->no_button_delete <> 1))
+        $object_is_used = $object->isObjectUsed($object->id);
+    
+        if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->supprimer)
+        || ($object->type == Product::TYPE_SERVICE && $user->rights->service->supprimer))
         {
-            if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))
+            if (empty($object_is_used) && (! isset($object->no_button_delete) || $object->no_button_delete <> 1))
             {
-                print '<div class="inline-block divButAction"><span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span></div>'."\n";
+                if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))
+                {
+                    print '<div class="inline-block divButAction"><span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span></div>'."\n";
+                }
+                else
+    			{
+                    print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&amp;id='.$object->id.'">'.$langs->trans("Delete").'</a></div>';
+                }
             }
             else
-			{
-                print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&amp;id='.$object->id.'">'.$langs->trans("Delete").'</a></div>';
+    		{
+                print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("ProductIsUsed").'">'.$langs->trans("Delete").'</a></div>';
             }
         }
         else
-		{
-            print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("ProductIsUsed").'">'.$langs->trans("Delete").'</a></div>';
+    	{
+            print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Delete").'</a></div>';
         }
     }
-    else
-	{
-        print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Delete").'</a></div>';
-    }
+    
+    print "\n</div>\n";
 }
 
-print "\n</div>\n";
-
-
 /*
  * All the "Add to" areas
  */
@@ -1974,7 +1975,7 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action =
  * Documents generes
  */
 
-if ($action != 'edit' && $action != 'delete')
+if ($action != 'create' && $action != 'edit' && $action != 'delete')
 {
     print '<div class="fichecenter"><div class="fichehalfleft">';
     print '<a name="builddoc"></a>'; // ancre
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 74aef09e7a992ae2d0ff8e11259490aeea63cc83..0581ed1960e1d23055a16c3f00f9796465134247 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -3326,18 +3326,6 @@ class Societe extends CommonObject
 		return "Error, mode/status not found";
 	}
 
-	/**
-	 *  Set commnunication level
-	 *
-	 *  @param  User	$user		User making change
-	 *	@return	int					<0 if KO, >0 if OK
-     * @deprecated Use update function instead
-	 */
-	function set_commnucation_level($user)
-	{
-		return $this->update($this->id, $user);
-	}
-
 	/**
 	 *  Set outstanding value
 	 *
diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php
index 2bda75867dc8534bec1799b325c32970f339e294..b5ffc87517ff57bb910cd05eb5cb4ddcb7dccd11 100644
--- a/htdocs/societe/societecontact.php
+++ b/htdocs/societe/societecontact.php
@@ -107,13 +107,14 @@ else if ($action == 'deletecontact' && $user->rights->societe->creer)
 		dol_print_error($db);
 	}
 }
-
+/*
 else if ($action == 'setaddress' && $user->rights->societe->creer)
 {
 	$object->fetch($id);
 	$result=$object->setDeliveryAddress($_POST['fk_address']);
 	if ($result < 0) dol_print_error($db,$object->error);
-}
+}*/
+
 
 /*
  * View