From b55830d20557c964af7a5d2df9b5ff0d0a51eb66 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Feb 2022 14:03:09 +0100 Subject: [PATCH] Fix missing information propagated to trigger --- htdocs/compta/facture/card.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 4e2665ceca3..da438af9e01 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1135,6 +1135,8 @@ if (empty($reshook)) { $facture_source->fetchPreviousNextSituationInvoice(); } } + + $id = $object->create($user); if ($id < 0) { $error++; @@ -1262,6 +1264,7 @@ if (empty($reshook)) { $line->multicurrency_total_tva = -$line->multicurrency_total_tva; $line->multicurrency_total_ttc = -$line->multicurrency_total_ttc; + $line->context['createcreditnotefrominvoice'] = 1; $result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked $object->lines[] = $line; // insert new line in current object