Merge pull request #18563 from atm-maxime/patch-3

Fix supplier invoice pdf generation canelle
This commit is contained in:
Laurent Destailleur 2021-09-01 13:37:50 +02:00 committed by GitHub
commit cd09099409
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -208,7 +208,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
global $user, $langs, $conf, $mysoc, $hookmanager, $nblines;
// Get source company
if (!is_object($object->thirdparty)) $object->fetch_thirdparty();
$object->fetch_thirdparty();
if (!is_object($object->thirdparty)) $object->thirdparty = $mysoc; // If fetch_thirdparty fails, object has no socid (specimen)
$this->emetteur = $object->thirdparty;
if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
@ -224,8 +224,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
if ($conf->fournisseur->facture->dir_output)
{
$object->fetch_thirdparty();
$deja_regle = $object->getSommePaiement(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$amount_credit_notes_included = $object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$amount_deposits_included = $object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);