You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an instance set a default tax category, Spree::Variant will override the tax_category association and return the default one if none are set on the variant.
This is confusing as it doesn't reflect the data in the database, and "None" (as in none set) is valid tax category.
We should remove this override and fix the underlying data.
Fix
Currently only ca_prod, fr_prod, uk_prod, nz_prod, in_prod have a default tax category set. Number of variants with no tax category for each instance :
ca_prod 28886
fr_prod 44277
in_prod 15
nz_prod 2309
uk_prod 126871
We will need to migrate all these variants to the default tax category.
Then we can remove the association override, and we should update the "Add new product" UI to select the default tax category when there is one set. This should get us close to the current behaviour.
What we should change and why (this is tech debt)
When an instance set a default tax category,
Spree::Variant
will override thetax_category
association and return the default one if none are set on the variant.openfoodnetwork/app/models/spree/variant.rb
Lines 172 to 174 in 2adb69e
This is confusing as it doesn't reflect the data in the database, and "None" (as in none set) is valid tax category.
We should remove this override and fix the underlying data.
Fix
Currently only ca_prod, fr_prod, uk_prod, nz_prod, in_prod have a default tax category set. Number of variants with no tax category for each instance :
We will need to migrate all these variants to the default tax category.
Then we can remove the association override, and we should update the "Add new product" UI to select the default tax category when there is one set. This should get us close to the current behaviour.
Context
This came up in PR: #12333 , more context #12333 (comment)
The text was updated successfully, but these errors were encountered: