From 59e4b3d634a46d1716ae5c611b5c4e6ef34f2f8a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 12 Mar 2020 04:56:36 +0100 Subject: [PATCH] FIX: Accounting management of intra-community sales to a non-taxable thirdparty Related to this discussion : https://www.dolibarr.fr/forum/t/gestion-des-comptes-de-vente-intracommunautaire-et-vente-ce-non-exemptee-de-tva/32285 --- htdocs/accountancy/customer/list.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index d964d348889..c0e40abd8c8 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -439,7 +439,10 @@ if ($result) { $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : ''); $suggestedaccountingaccountbydefaultfor = ''; } else { - if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale + if ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale without VAT intra community number + $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = ''; + } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : ''); $suggestedaccountingaccountbydefaultfor = 'eec'; } else { // Foreign sale @@ -452,7 +455,10 @@ if ($result) { $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : ''); $suggestedaccountingaccountbydefaultfor = ''; } else { - if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale + if ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale without VAT intra community number + $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = ''; + } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : ''); $suggestedaccountingaccountbydefaultfor = 'eec'; } else { @@ -470,7 +476,11 @@ if ($result) { $objp->aarowid_suggest = $objp->aarowid; $suggestedaccountingaccountfor = ''; } else { - if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale + if ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale without VAT intra community number + $objp->code_sell_p = $objp->code_sell; + $objp->aarowid_suggest = $objp->aarowid; + $suggestedaccountingaccountfor = ''; + } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale $objp->code_sell_p = $objp->code_sell_intra; $objp->aarowid_suggest = $objp->aarowid_intra; $suggestedaccountingaccountfor = 'eec';