|
Author: jleroux
Date: Tue Feb 15 10:40:17 2011 New Revision: 1070830 URL: http://svn.apache.org/viewvc?rev=1070830&view=rev Log: A patch from Paul Foxworthy "Tax not added for order shipping or promotion" (https://issues.apache.org/jira/browse/OFBIZ-4160) - OFBIZ-4160 When shipping is calculated for the entire order or a promotion adjustment is made, the relevant tax rows from the TaxAuthorityRateProduct table are not being found. This bug was discovered independently by Sergei Biletnikov, see http://ofbiz.135035.n4.nabble.com/VAT-is-not-applied-for-the-shipping-td3234699.html. I committed Paul's (slightly modified: formatting) patch with an explanation on screen. I will later add an enforcing js script This is not a definitive answer but a workaround, see http://markmail.org/message/ewvaljuqg3voiy2s for more Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java ofbiz/trunk/applications/accounting/widget/TaxAuthorityScreens.xml Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=1070830&r1=1070829&r2=1070830&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original) +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Tue Feb 15 10:40:17 2011 @@ -10953,6 +10953,10 @@ <value xml:lang="zh">ç¨å¡æºå ³</value> <value xml:lang="zh_TW">ç¨ åæ©é</value> </property> + <property key="AccountingTaxAuthorityCategoryAdvice"> + <value xml:lang="en">Beware: don't use more than one line with "Tax Shipping" and/or "Tax Promotions" value = "Y"</value> + <value xml:lang="fr">Attention: n'utilisez pas plus d'une ligne avec "Taxes sur livraison" et/ou "Taxes sur promotions" = "Y"</value> + </property> <property key="AccountingTaxAuthorityGeo"> <value xml:lang="en">Tax Authority Geo</value> <value xml:lang="fr">Zone géographique de l'administration fiscale</value> @@ -15365,6 +15369,7 @@ </property> <property key="FormFieldTitle_taxPromotions"> <value xml:lang="en">Tax Promotions</value> + <value xml:lang="fr">Taxes sur promotions</value> <value xml:lang="hi_IN">à¤à¥à¤à¥à¤¸ सà¤à¤µà¤°à¥à¤§à¤¨</value> <value xml:lang="it">Tassa promozioni</value> <value xml:lang="pt">Imposto sobre promoções</value> @@ -17274,10 +17279,10 @@ <value xml:lang="en">Payment receive via iDEAL</value> <value xml:lang="hi_IN">à¤à¥à¤à¤¤à¤¾à¤¨ iDEAL à¤à¥ माधà¥à¤¯à¤® सॠपà¥à¤°à¤¾à¤ªà¥à¤¤</value> <value xml:lang="it">Pagamento ricevuto da iDEAL</value> - <value xml:lang="nl">Betalingsontvangst via iDEAL</value> + <value xml:lang="nl">Betalingsontvangst via iDEAL</value> </property> <property key="IdealSuccessFull"> <value xml:lang="en">The transaction has been successfull.</value> - <value xml:lang="nl">De betaling is met succes ontvangen.</value> + <value xml:lang="nl">De betaling is met succes ontvangen.</value> </property> </resource> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java?rev=1070830&r1=1070829&r2=1070830&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java Tue Feb 15 10:40:17 2011 @@ -350,6 +350,33 @@ public class TaxAuthorityServices { productCategoryCond = EntityCondition.makeCondition("productCategoryId", EntityOperator.EQUALS, null); } + // FIXME handles shipping and promo tax. Simple solution, see https://issues.apache.org/jira/browse/OFBIZ-4160 for a better one + if (product == null && shippingAmount != null) { + EntityCondition taxShippingCond = EntityCondition.makeCondition( + EntityCondition.makeCondition("taxShipping", EntityOperator.EQUALS, null), + EntityOperator.OR, + EntityCondition.makeCondition("taxShipping", EntityOperator.EQUALS, "Y")); + + if (productCategoryCond != null) { + productCategoryCond = EntityCondition.makeCondition(productCategoryCond, + EntityOperator.OR, + taxShippingCond); + } + } + + if (product == null && orderPromotionsAmount != null) { + EntityCondition taxOrderPromotionsCond = EntityCondition.makeCondition( + EntityCondition.makeCondition("taxPromotions", EntityOperator.EQUALS, null), + EntityOperator.OR, + EntityCondition.makeCondition("taxPromotions", EntityOperator.EQUALS, "Y")); + + if (productCategoryCond != null) { + productCategoryCond = EntityCondition.makeCondition(productCategoryCond, + EntityOperator.OR, + taxOrderPromotionsCond); + } + } + // build the main condition clause List<EntityCondition> mainExprs = UtilMisc.toList(storeCond, taxAuthoritiesCond, productCategoryCond); mainExprs.add(EntityCondition.makeCondition(EntityCondition.makeCondition("minItemPrice", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("minItemPrice", EntityOperator.LESS_THAN_EQUAL_TO, itemPrice))); Modified: ofbiz/trunk/applications/accounting/widget/TaxAuthorityScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/TaxAuthorityScreens.xml?rev=1070830&r1=1070829&r2=1070830&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/TaxAuthorityScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/TaxAuthorityScreens.xml Tue Feb 15 10:40:17 2011 @@ -193,8 +193,10 @@ under the License. <decorator-screen name="CommonTaxAuthorityDecorator" location="${parameters.taxAuthDecoratorLocation}"> <decorator-section name="body"> <screenlet id="TaxAuthorityCategoryPanel" title="${uiLabelMap.PageTitleAddTaxAuthorityCategory}" collapsible="true"> + <label style="h3">${uiLabelMap.AccountingTaxAuthorityCategoryAdvice}</label> <include-form name="AddTaxAuthorityRateProduct" location="component://accounting/widget/TaxAuthorityForms.xml"/> </screenlet> + <label style="h3">${uiLabelMap.AccountingTaxAuthorityCategoryAdvice}</label> <include-form name="ListTaxAuthorityRateProducts" location="component://accounting/widget/TaxAuthorityForms.xml"/> </decorator-section> </decorator-screen> |
| Free forum by Nabble | Edit this page |
