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

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1070830 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2011-02-15 10:40:17 +00:00
parent 329c8e2431
commit 7ffa102b2d
3 changed files with 36 additions and 2 deletions
@@ -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>
@@ -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)));
@@ -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>