saleor / saleor-dashboard

A GraphQL-powered, single-page dashboard application for Saleor.
BSD 3-Clause "New" or "Revised" License
842 stars 1.1k forks source link

Vatlayer: Wrong tax and no choice of different tax rates #1480

Closed tmechsner closed 3 years ago

tmechsner commented 3 years ago

What I'm trying to achieve

  1. I want to have taxes correctly calculated.
  2. I want to be able to configure reduced tax rates.

Steps to reproduce the problem

  1. Create a new "default-channel" with currency EUR and default country Germany.
  2. Configure Vatlayer plugin for Germany (Origin Country = DE, Countries for which taxes will be calculated from origin country = DE)
  3. Fetch Taxes under configuration -> taxes. This initially didn't not work because of a rate limitation on Vatlayer side. Your django-prices-vatlayer package sends two requests right one after the other, which is too quickly. I added a delay, now it works - so I have tax data for many countries. Among them is also Germany with the correct standard tax rate (I checked in the database) and several reduced rates. Configuration-wise I have all three checkboxes checked.
  4. Create a Product Type or Product: There is only one Tax rate "standard" available.
  5. Place an order, look at the dashboard again: The calculated tax is anything but correct. See examples appended as screenshots. All these orders have been placed with the same configuration as described above. Only one channel, all products have tax rate "standard" (there is no other tax rate available anyways..)

Screenshots

Bildschirmfoto 2021-10-08 um 18 29 50 Bildschirmfoto 2021-10-08 um 18 30 02 Bildschirmfoto 2021-10-08 um 18 30 10

Http request and response from inspector

The part of the graphql request regarding taxes when opening the page to create a new product in the dashboard:

{
  "operationName": "TaxTypeList",
  "variables": {
    "PERMISSION_HANDLE_PAYMENTS": true,
    "PERMISSION_IMPERSONATE_USER": true,
    "PERMISSION_MANAGE_APPS": true,
    "PERMISSION_MANAGE_CHANNELS": true,
    "PERMISSION_MANAGE_CHECKOUTS": true,
    "PERMISSION_MANAGE_DISCOUNTS": true,
    "PERMISSION_MANAGE_GIFT_CARD": true,
    "PERMISSION_MANAGE_MENUS": true,
    "PERMISSION_MANAGE_ORDERS": true,
    "PERMISSION_MANAGE_PAGES": true,
    "PERMISSION_MANAGE_PAGE_TYPES_AND_ATTRIBUTES": true,
    "PERMISSION_MANAGE_PLUGINS": true,
    "PERMISSION_MANAGE_PRODUCTS": true,
    "PERMISSION_MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES": true,
    "PERMISSION_MANAGE_SETTINGS": true,
    "PERMISSION_MANAGE_SHIPPING": true,
    "PERMISSION_MANAGE_STAFF": true,
    "PERMISSION_MANAGE_TRANSLATIONS": true,
    "PERMISSION_MANAGE_USERS": true
  },
  "query": "fragment TaxTypeFragment on TaxType {\n  description\n  taxCode\n  __typename\n}\n\nquery TaxTypeList {\n  taxTypes {\n    ...TaxTypeFragment\n    __typename\n  }\n}\n"
}

Reponse (only the part regarding taxes)

{
    "data": {
      "taxTypes": [
        {
          "description": "standard",
          "taxCode": "standard",
          "__typename": "TaxType"
        }
      ]
    }
  }

Console output

Nothing

System information

Saleor version:

Operating system:

Browser:

tmechsner commented 3 years ago

Fixed. It was due to a wrong translation in the dashboard frontend, so just a misconfiguration. There's still an issue with the missing list of tax rates - I'll open a new issue for that.