Fix transfer in accountancy for supplier invoices

This commit is contained in:
Laurent Destailleur 2021-11-15 09:57:41 +01:00
parent 5dd2bedffa
commit 5a1f54f47f

View File

@ -820,7 +820,7 @@ class AccountingAccount extends CommonObject
if ($type=='customer' && !empty($product->accountancy_code_sell)) { if ($type=='customer' && !empty($product->accountancy_code_sell)) {
$code_p = $product->accountancy_code_sell; $code_p = $product->accountancy_code_sell;
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) { } elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) {
$code_p = $product->accountancy_code_sell; $code_p = $product->accountancy_code_buy;
} }
$suggestedid = $accountingAccount['dom']; $suggestedid = $accountingAccount['dom'];
$suggestedaccountingaccountfor = 'prodserv'; $suggestedaccountingaccountfor = 'prodserv';
@ -830,7 +830,7 @@ class AccountingAccount extends CommonObject
if ($type=='customer' && !empty($product->accountancy_code_sell)) { if ($type=='customer' && !empty($product->accountancy_code_sell)) {
$code_p = $product->accountancy_code_sell; $code_p = $product->accountancy_code_sell;
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) { } elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) {
$code_p = $product->accountancy_code_sell; $code_p = $product->accountancy_code_buy;
} }
$suggestedid = $accountingAccount['dom']; $suggestedid = $accountingAccount['dom'];
$suggestedaccountingaccountfor = 'eecwithvat'; $suggestedaccountingaccountfor = 'eecwithvat';
@ -839,7 +839,7 @@ class AccountingAccount extends CommonObject
if ($type=='customer' && !empty($product->accountancy_code_sell)) { if ($type=='customer' && !empty($product->accountancy_code_sell)) {
$code_p = $product->accountancy_code_sell; $code_p = $product->accountancy_code_sell;
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) { } 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 ? $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'; $suggestedaccountingaccountfor = 'eecwithoutvatnumber';
@ -854,11 +854,10 @@ class AccountingAccount extends CommonObject
$suggestedaccountingaccountfor = 'eec'; $suggestedaccountingaccountfor = 'eec';
} else { } else {
// Foreign sale // Foreign sale
// European intravat sale
if ($type=='customer' && !empty($product->accountancy_code_sell_export)) { if ($type=='customer' && !empty($product->accountancy_code_sell_export)) {
$code_p = $product->accountancy_code_sell_export; $code_p = $product->accountancy_code_sell_export;
} elseif ($type=='supplier' && !empty($product->accountancy_code_sell_export)) { } elseif ($type=='supplier' && !empty($product->accountancy_code_buy_export)) {
$code_p = $product->accountancy_code_sell_export; $code_p = $product->accountancy_code_buy_export;
} }
$suggestedid = $accountingAccount['export']; $suggestedid = $accountingAccount['export'];
$suggestedaccountingaccountfor = 'export'; $suggestedaccountingaccountfor = 'export';