Merge pull request #8072 from laudeco/hotfix/8028_replacement_bill

fix the bill replacement with discounts #8028
This commit is contained in:
Laurent Destailleur 2018-02-20 15:19:19 +01:00 committed by GitHub
commit 7f419a29e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -539,6 +539,15 @@ class Facture extends CommonInvoice
}
$newinvoiceline->fk_parent_line=$fk_parent_line;
if($this->type === Facture::TYPE_REPLACEMENT && $newinvoiceline->fk_remise_except){
$discount = new DiscountAbsolute($this->db);
$discount->fetch($newinvoiceline->fk_remise_except);
$discountId = $soc->set_remise_except($discount->amount_ht, $user, $discount->description, $discount->tva_tx);
$newinvoiceline->fk_remise_except = $discountId;
}
$result=$newinvoiceline->insert();
// Defined the new fk_parent_line