From 5a1f54f47fd4dfce9fb056151fbdfc13b5f12da8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Nov 2021 09:57:41 +0100 Subject: [PATCH] Fix transfer in accountancy for supplier invoices --- htdocs/accountancy/class/accountingaccount.class.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 7523140534a..5c5faa837b7 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -820,7 +820,7 @@ class AccountingAccount extends CommonObject if ($type=='customer' && !empty($product->accountancy_code_sell)) { $code_p = $product->accountancy_code_sell; } elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) { - $code_p = $product->accountancy_code_sell; + $code_p = $product->accountancy_code_buy; } $suggestedid = $accountingAccount['dom']; $suggestedaccountingaccountfor = 'prodserv'; @@ -830,7 +830,7 @@ class AccountingAccount extends CommonObject if ($type=='customer' && !empty($product->accountancy_code_sell)) { $code_p = $product->accountancy_code_sell; } elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) { - $code_p = $product->accountancy_code_sell; + $code_p = $product->accountancy_code_buy; } $suggestedid = $accountingAccount['dom']; $suggestedaccountingaccountfor = 'eecwithvat'; @@ -839,7 +839,7 @@ class AccountingAccount extends CommonObject if ($type=='customer' && !empty($product->accountancy_code_sell)) { $code_p = $product->accountancy_code_sell; } elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) { - $code_p = $product->accountancy_code_sell; + $code_p = $product->accountancy_code_buy; } $suggestedid = $accountingAccount['dom']; // There is a doubt for this case. Is it an error on vat or we just forgot to fill vat number ? $suggestedaccountingaccountfor = 'eecwithoutvatnumber'; @@ -854,11 +854,10 @@ class AccountingAccount extends CommonObject $suggestedaccountingaccountfor = 'eec'; } else { // Foreign sale - // European intravat sale if ($type=='customer' && !empty($product->accountancy_code_sell_export)) { $code_p = $product->accountancy_code_sell_export; - } elseif ($type=='supplier' && !empty($product->accountancy_code_sell_export)) { - $code_p = $product->accountancy_code_sell_export; + } elseif ($type=='supplier' && !empty($product->accountancy_code_buy_export)) { + $code_p = $product->accountancy_code_buy_export; } $suggestedid = $accountingAccount['export']; $suggestedaccountingaccountfor = 'export';