From 3393759675be8269e9c4df25847f0d55f53dc77c Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Thu, 9 Oct 2025 00:32:54 +0200 Subject: [PATCH] Fix ref and fk_doc fields to match working entries - Add ref field = declaration_name for both debit and credit entries - Change fk_doc from declaration->rowid to 0 to match working entries - These fields are critical for proper accounting entry creation - Based on comparison with working OD journal entries --- core/class/declarationtva.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/class/declarationtva.class.php b/core/class/declarationtva.class.php index 28ae7a9..e8ea68c 100644 --- a/core/class/declarationtva.class.php +++ b/core/class/declarationtva.class.php @@ -1250,12 +1250,13 @@ class DeclarationTVA $debit = new Bookkeeping($this->db); $debit->doc_date = dol_mktime(0, 0, 0, date('m', strtotime($declaration->end_date)), date('d', strtotime($declaration->end_date)), date('Y', strtotime($declaration->end_date))); $debit->doc_ref = $declaration->declaration_name; + $debit->ref = $declaration->declaration_name; $debit->code_journal = 'OD'; $debit->numero_compte = $entry['account_code']; $debit->label_compte = $entry['account_label']; $debit->montant = price2num($debit_amount, 'MT'); $debit->sens = 'D'; - $debit->fk_doc = $declaration->rowid; + $debit->fk_doc = 0; $debit->fk_user_author = $user->id; $debit->entity = $this->entity; $debit->date_creation = dol_now(); @@ -1304,12 +1305,13 @@ class DeclarationTVA $credit = new Bookkeeping($this->db); $credit->doc_date = dol_mktime(0, 0, 0, date('m', strtotime($declaration->end_date)), date('d', strtotime($declaration->end_date)), date('Y', strtotime($declaration->end_date))); $credit->doc_ref = $declaration->declaration_name; + $credit->ref = $declaration->declaration_name; $credit->code_journal = 'OD'; $credit->numero_compte = $entry['account_code']; $credit->label_compte = $entry['account_label']; $credit->montant = price2num($credit_amount, 'MT'); $credit->sens = 'C'; - $credit->fk_doc = $declaration->rowid; + $credit->fk_doc = 0; $credit->fk_user_author = $user->id; $credit->entity = $this->entity; $credit->date_creation = dol_now();