diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 34ed1383e14377497a60f67699ec23019beea895..a5e4334228dc73d5026cd58c4d8d8ed52d006654 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -771,7 +771,7 @@ if (empty($reshook))
 	                        $line->fk_parent_line = $fk_parent_line;
 
 	                        $line->subprice =-$line->subprice; // invert price for object
-	                        $line->pa_ht = -$line->pa_ht;
+	                        $line->pa_ht = $line->pa_ht;
 	                        $line->total_ht=-$line->total_ht;
 	                        $line->total_tva=-$line->total_tva;
 	                        $line->total_ttc=-$line->total_ttc;
diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql
index 86d2549a8bc4017a622ef4569b43ef782baf5d1f..88ba07cc24bae8b637731ac087a4ccb03e7a1b3f 100755
--- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql
+++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql
@@ -611,3 +611,7 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (14
 -- VMYSQL4.1 ALTER TABLE llx_c_type_resource CHANGE COLUMN rowid rowid integer NOT NULL AUTO_INCREMENT;
 
 ALTER TABLE llx_import_model MODIFY COLUMN type varchar(50);
+
+-- Negative buying prices
+
+UPDATE llx_facturedet SET buy_price_ht = ABS(buy_price_ht)