Wrong Sales tax rate in Purchase order - V 16.x.x

Hi
Problem in purchase order creation:
While creating PO the system shows wrong sales tax of a product, this problem is persist from V16. I was excepting the correction in 16.0.2 but it is still persist. Kindly do the needful. the new users of our Dolibarr did know about the product tax rate. so they are making this mistake and we are facing serious problems.
Please see the attached screenshot
thanks and regards
G Venkatesan


You are on a Purchase Order. So the vat is not defined by the selling price (this is for sale orders) but must be defined into the “Buying prices”

Dear eldy
Thank you for the reply. In INDIA the purchase Vat and Sales Vat both are same. Also we use 0%, 5%, 18% and 28% (multiple VAT rate BUT unique per product). It is good for us to use product’s default VAT rate in all the card. (Quotation, Sales Order, Invoice, Purchase order). It was fine until Dolibarr V.15.X.X. From V 16.0 onward we are facing this issue. It is difficult to train the purchase staff about different VAT rat per products. Hope something can be done for our case.
thanks and regards
G Venkatesan

Yes, they are same in most countries. But you must define it on the buy price tab when setting the buy price to have it used.
On sell price, you define the sell price and vat of sell price
On buying price, you define the buying price and vat of the buying price
Note this was already the case with previous version.

Dear eldy
Sorry to bother you.
In previous version (15.0) the system uses Default VAT rate for creating any card. I have still V 15.0 installation running in another test hosting. I have double checked your reply. Please see the attached screen shoot, for that particular product i have tested, there is no buying price defined, but system correctly working using default vat rate of that product.



When there is no buying price defined, the system use a default value for vat rate.

This default value should be:

  • 0 if the seller and buyer are into different countries
  • if in same country than vendor, it should be the higher rate defined into dictionnary of vat for your own country

Can you check the country of vendor and yours ?

So far we never defined buying price in any product (we are using dolibarr last two years). It worked good until V15. The system was using default vat rate. From V16 onward system looks dictionary and assign higher VAT rate 28% which is not relevant for many products.The Vendor and we are in the same Country.
It is good to use default VAT rate of that product.

OK. I think i’ve got the point.
Currently, the implemented rule when no vat rate is defined for purchased product, is to take the “higher rate”. This is a rule that works in a lot of countries, but not for you. A change in on the road to allow to define the “default vat rate” into the dictionary of vat so you will be able to define it from the interface to avoid using the old rule of the higher rate.
Before this is ready, you can already change this this way:
Go into home - setup - other and add the constant
MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS with value “yy (xxx)” where yy is the vat rate (for you 18) and xxx is the code of the vat into the dictionary of sales taxes. If this code is empty, just put “yy”.

Note: I don’t know why you got 18 in v15, because the rule of the fallback (when no sales tax for purchase is defined) is the same since a long date, but it is clear reading the code in v16 that you will get 28 by default, except if you set MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS to another value

Dear Eldy
thank you for your reply.
I have again checked with V.15.0.2 with all VAT rate it works fine (please see the attached screenshot).
Please Note:-

  1. In V16.0 the problem persist only in Purchase Order creation and no issue in other places like sales order and Invoice.
  2. In V 15.0, the system uses the default vat rate defined in product card at Selling Price—>Default tax rate.
  3. there is no Default vat rate defined for any product at Buying Price also there is no such a place to define vat rate like one available at Selling Price tab.
    So I am experiencing the issue in V16.0 is the system not bringing Default tax rate from Selling Price tab (only in Purchase order creation).
    Unfortunately I could not use the constant MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS rather I can manually set vat rate at Buying Price for all the product to use the higher version. (please see the attached screenshot)
    Thank you for your valuable support
    with regards
    Venkatesan

@sribalaji.tvn Why can’t you use the MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS constant ?
This constant is used only if no default vat is found.
So, for sales, the vat defined on selling price is used (not this constant).
For purchase, the vat defined on buy price is used, and MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS is used ONLY if no buy price is defined.

In INDIA, we are using 0%, 5%, 12%, 18% (majority) and 28%, so the constant value setup always offer unique tax rate .If we define 18% than system will offer 18% for all products which makes confusion in real time business.
Also we are not using separate vat rate for sales and purchase, So far It was good (V15.0) the system was using default vat rate (defined at product card at selling price tab)for both Sales and Purchase.

I would like to add, The VAT defined at buy price is only works for that particular vendor only and if I create PO for the same product but buy from different vendor than system assigns different VAT rate.

Thanks for all description. I think to a way to solve your trouble: I pushed a fix to have the default vat rate that is the on of sale if no purchase prices are defined.
However, this will be available with v17. Change is inside get_product_vat_for_country() function.
I will need test and feedback on the v17 beta to knwo if it is ok.

Thanks for all your support, I do not know how to test the Beta 17 otherwise I would test and give you feedback. I will do once it is available for public.

Hello,

Just download the version from GITHUB : https://github.com/Dolibarr/dolibarr/archive/refs/heads/17.0.zip

Thank you ksar
I have tested the option in 17 Beta (Change is inside get_product_vat_for_country() function) but it is not working. please find attached screenshot for your reference.


Sorry, my fix was not complete.
I have just pushed into 17.0 branch, a better fix.

Great job!
This issue has been solved in V17 beta. also I found a wonderful feature U.P (net) and U.P (inc. tax) in Invoice creation (Now easy to make invoice).
Excellent!!!
thanks a lot