Merge pull request #18480 from henrynopo/patch-11

Fix - Supplier deposit invoice - auto convert to discount (error)
This commit is contained in:
Laurent Destailleur 2021-08-24 14:09:39 +02:00 committed by GitHub
commit 9816dff00a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -223,10 +223,10 @@ class PaiementFourn extends Paiement
// If we want to closed paid invoices
if ($closepaidinvoices) {
$paiement = $invoice->getSommePaiement();
//$creditnotes=$invoice->getSumCreditNotesUsed();
$creditnotes = 0;
//$deposits=$invoice->getSumDepositsUsed();
$deposits = 0;
$creditnotes=$invoice->getSumCreditNotesUsed();
//$creditnotes = 0;
$deposits=$invoice->getSumDepositsUsed();
//$deposits = 0;
$alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
$remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
if ($remaintopay == 0) {
@ -238,7 +238,7 @@ class PaiementFourn extends Paiement
// Insert one discount by VAT rate category
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
$discount = new DiscountAbsolute($this->db);
$discount->fetch('', $invoice->id);
$discount->fetch('', 0, $invoice->id);
if (empty($discount->id)) { // If the invoice was not yet converted into a discount (this may have been done manually before we come here)
$discount->discount_type = 1; // Supplier discount
$discount->description = '(DEPOSIT)';