Re: Dev - Questions about the way taxes are calculated

Posted by David E. Jones on
URL: http://ofbiz.116.s1.nabble.com/Dev-Questions-about-the-way-taxes-are-calculated-tp167888p167889.html



Jacopo Cappellato wrote:
> Hi all,
>
> I have some questions about the way taxes are calculated (in the
> "calcTax" service, implemented by the
> TaxAuthorityServices.rateProductTaxCalc method):
>
> 1) why applicable tax rates are filtered by productStoreId? and why the
> productStoreId is a mandatory parameter?

Answer below...

>
> 2) when applicable tax rates are searched, the rates for the _NA_ geoId
> and taxAuthPartyId are always applied (in addition to others, country
> specific, taxes); shouldn't the _NA_ taxes only applied when no other
> taxes are found? I cannot see how the _NA_ taxes would be useful as they
> are now...

This is intended to work kind of like the productStoreId (as described below).

What did you have in mind as for how this would work? The idea for them is to apply taxes when you don't care about the geo or taxAuthority, though I'm not sure that is ever a good idea anyway...

>
> About #1, I'd prefer to make the productStoreId optional so that, at least:
> - if the store is passed, only the tax rates for the product stores are
> applied (exactly as is now)
> - if the store is not passed, only the tax rates in which the
> productStoreId is null are applied
>
> However, I really don't see big advantages of keeping the productStoreId
> in the TaxAuthorityRateProduct at all.
> As things are implemented now, if I'm not wrong, if I want to set up a
> tax rate of 20% for all the Italian customers, and I have 20 stores,
> I'll have to create 20 different rules (one for each store) for the same
> rate (20%)...

The way this _should_ be working (unless I messed up the implementation or wasn't thinking clearly at the time...) is that the productStoreId should be passed in, and to address the issue you are talking about when querying the TARP records it should look for all with that productStoreId or that are null. That way if you want a global tax setting, you leave the productStoreId null. If you want to constrain it to a store then you set it in the TARP record. In order for that to work it should always be passed into the service though...

-David
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev