diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index d08feba9b14dca35b0a06322694ba378ddf80257..4995ab7eab046050c66a002ddead50c647cad423 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -643,8 +643,37 @@ else if ($action == 'add' && $user->rights->facture->creer) {
 
 			$id = $object->create($user);
 
+			if(GETPOST('invoiceAvoirWithLines', 'int')==1 && $id>0) {
+			    
+                $facture_source = new Facture($db); // fetch origin object
+                if($facture_source->fetch($object->fk_facture_source)>0) {
+                
+                    foreach($facture_source->lines as $line) {
+                      
+                        $line->fk_facture = $object->id;  
+                        
+                        $line->subprice =-$line->subprice; // invert price for object
+                        $line->pa_ht = -$line->pa_ht;
+                        $line->total_ht=-$line->total_ht;
+                        $line->total_tva=-$line->total_tva;
+                        $line->total_ttc=-$line->total_ttc;
+                        $line->total_localtax1=-$line->total_localtax1;
+                        $line->total_localtax2=-$line->total_localtax2;
+                        
+                        $line->insert();
+                        
+                        $object->lines[] = $line; // insert new line in current object
+                    }
+                 
+                    $object->update_price(1);   
+                }
+                 
+			}
+            
 			// Add predefined lines
-			for($i = 1; $i <= $NBLINES; $i ++) {
+			/*
+             TODO delete 
+             for($i = 1; $i <= $NBLINES; $i ++) {
 				if ($_POST ['idprod' . $i]) {
 					$product = new Product($db);
 					$product->fetch($_POST ['idprod' . $i]);
@@ -652,7 +681,7 @@ else if ($action == 'add' && $user->rights->facture->creer) {
 					$endday = dol_mktime(12, 0, 0, $_POST ['date_end' . $i . 'month'], $_POST ['date_end' . $i . 'day'], $_POST ['date_end' . $i . 'year']);
 					$result = $object->addline($product->description, $product->price, $_POST ['qty' . $i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST ['idprod' . $i], $_POST ['remise_percent' . $i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
 				}
-			}
+			}*/
 		}
 	}
 
@@ -2000,12 +2029,12 @@ if ($action == 'create')
 	if (empty($origin) && $socid > 0)
 	{
 		// Credit note
-		print '<tr height="18"><td valign="middle">';
+		print '<tr height="18"><td valign="top">';
 		print '<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked=true' : '');
 		if (! $optionsav)
 			print ' disabled="disabled"';
 		print '>';
-		print '</td><td valign="middle">';
+		print '</td><td valign="top">';
 		print '<script type="text/javascript" language="javascript">
 		jQuery(document).ready(function() {
 			jQuery("#fac_avoir").click(function() {
@@ -2028,6 +2057,9 @@ if ($action == 'create')
 		$text .= '</select>';
 		$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1);
 		print $desc;
+        
+        print '&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').attr(\'checked\',\'checked\')  }" /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
+        
 		print '</td></tr>' . "\n";
 	}
 
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index 4171fa5b675d49d78ad237053a2cd0203170a768..5e3e5af56a26beeed6c7eef68e11b381cf08ddc9 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -28,6 +28,7 @@ InvoiceReplacementDesc=<b>Replacement invoice</b> is used to cancel and replace
 InvoiceAvoir=Credit note
 InvoiceAvoirAsk=Credit note to correct invoice
 InvoiceAvoirDesc=The <b>credit note</b> is a negative invoice used to solve fact that an invoice has an amount that differs than amount really paid (because customer paid too much by error, or will not paid completely since he returned some products for example).
+invoiceAvoirWithLines=Create Credit Note with lines from the origin invoice
 ReplaceInvoice=Replace invoice %s
 ReplacementInvoice=Replacement invoice
 ReplacedByInvoice=Replaced by invoice %s
diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang
index c5bb1f35a7509c5758f98c7f950a23a01c89fcd1..7602dd3d37d0c5892d22a1b8b761eab3d807466d 100644
--- a/htdocs/langs/fr_FR/bills.lang
+++ b/htdocs/langs/fr_FR/bills.lang
@@ -28,6 +28,7 @@ InvoiceReplacementDesc=La <b>facture de remplacement</b> sert à annuler et remp
 InvoiceAvoir=Facture avoir
 InvoiceAvoirAsk=Facture avoir pour correction de la facture
 InvoiceAvoirDesc=La <b>facture d'avoir</b> est une facture négative destinée à compenser un montant de facture qui diffère du montant réellement versé (suite à un trop versé par le client par erreur ou un manque non versé par le client suite à un retour produit par exemple).
+invoiceAvoirWithLines=Créer la facture d'avoir avec les lignes de la facture d'origine
 ReplaceInvoice=Remplace la facture %s
 ReplacementInvoice=Remplacement facture
 ReplacedByInvoice=Remplacée par la facture %s