Hi Sergei,

The trouble is that in the rateProductTaxCalc method, getTaxAdjustments is
called once per product, plus once for shipping and once for adjustments. In
trunk these are lines 218, 244 and 228 in 
https://fisheye6.atlassian.com/browse/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java?hb=true
https://fisheye6.atlassian.com/browse/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java?hb=true
 

When we call getTaxAdjustments for shipping and promotion, there's no
product, so the product category matching won't work. My change was to look
for rows with taxShipping of Y when there's no product.

If your shipping is always calculated for an order and not by individual
order items, you could set taxShipping to Y for one row in
TaxAuthorityRateProduct (TARP) and N for the others. A bit of a hack, but it
would work.

Another possibility is to define a new TAXABLE product category independent
of any other, so you only need one row in TARP. The problem with this is you
need to assign a product to the TAXABLE category as you create the product.
For me in Australia, pretty well everything is taxed, so most products would
need the category set.

A third way, again a hack, is to create a dummy product category that no
product has, and add a row to TARP with taxShipping of Y. All other TARP
rows would have taxShipping of N.

A better fix would need more consideration and more work.

Some possibilities I can think of:

- Add a new column to TARP, perhaps called something like taxRuleType or
taxScope. It would have values PRODUCT, SHIPPING, PROMOTION. You would add
separate rows for tax rules for shipping and promotion. Each of the three
calls to getTaxAdjustment would supply a parameter to say which taxRuleType
to search for.

- Define entirely separate entities for tax rules for shipping and
promotions rather than overload TARP

Cheers

Paul Foxworthy
-- 
View this message in context: 
http://ofbiz.135035.n4.nabble.com/VAT-is-not-applied-for-the-shipping-tp3234699p3253480.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply via email to