diff --git a/ChangeLog b/ChangeLog
index 04a5b8a7d1b063654c0e36ce5274e62fd08428a3..cb2b906ea275b8ea066daf1907d4f63a9778f3e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,8 @@ Fix: [ bug #1352 ] Removing a shipping does not remove the delivery.
 Fix: Option MAIN_INVERT_SENDER_RECIPIENT broken with typhon template.
 Fix: Can disable features with PHPEXCEL (no DLSF compatible).
 Fix: Can disable features with CKEDITOR. 
+Fix: Pb of records not correctly cleaned when module marge is
+     uninstalled (conflict between 'margin' and 'margins').
 
 ***** ChangeLog for 3.5.2 compared to 3.5.1 *****
 Fix: Can't add user for a task.
diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php
index f71fd6ed53f2a5df4d6cdcdc7c6621e57cc81b57..d0cfa8d4edd025ef148c5dd3e3b60fd1475860f0 100644
--- a/htdocs/core/modules/modMargin.class.php
+++ b/htdocs/core/modules/modMargin.class.php
@@ -42,7 +42,7 @@ class modMargin extends DolibarrModules
 		// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
 		$this->numero = 59000;
 		// Key text used to identify module (for permissions, menus, etc...)
-		$this->rights_class = 'margin';
+		$this->rights_class = 'margins';
 
 		// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
 		// It is used to group modules in module setup page
@@ -114,7 +114,6 @@ class modMargin extends DolibarrModules
 
 		// Permissions
 		$this->rights = array();
-		$this->rights_class = 'margins';
 		$r=0;
 
 		$r++;
diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql
index 7fc424caa739a21c41f663a808747d23a4b4a973..a058588ddef1a43c1068db018c56cfaefd6efed5 100644
--- a/htdocs/install/mysql/migration/repair.sql
+++ b/htdocs/install/mysql/migration/repair.sql
@@ -3,7 +3,6 @@
 -- when current version is 2.6.0 or higher. 
 --
 
-
 -- Requests to clean corrupted database
 
 -- delete foreign key that should never exists
@@ -101,6 +100,10 @@ UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps
 -- VMYSQL4.1 DELETE T1 FROM llx_boxes_def as T1, llx_boxes_def as T2 where T1.entity = T2.entity AND T1.file = T2.file AND T1.note = T2.note and T1.rowid > T2.rowid;
 -- VPGSQL8.2 DELETE FROM llx_boxes_def as T1 WHERE rowid NOT IN (SELECT min(rowid) FROM llx_boxes_def GROUP BY file, entity, note);
 
+-- We delete old entries into menu for module margin (pb with margin and margins)
+-- VMYSQL DELETE from llx_menu where module = 'margin' and url = '/margin/index.php' and not exists (select * from llx_const where name = 'MAIN_MODULE_MARGIN' or name = 'MAIN_MODULE_MARGINS');
+-- VMYSQL DELETE from llx_menu where module = 'margins' and url = '/margin/index.php' and not exists (select * from llx_const where name = 'MAIN_MODULE_MARGIN' or name = 'MAIN_MODULE_MARGINS');
+
 
 -- Requests to clean old tables or fields