-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add tax reverse charge mode #6169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add tax reverse charge mode #6169
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6169 +/- ##
==========================================
- Coverage 88.80% 88.79% -0.01%
==========================================
Files 842 842
Lines 18235 18247 +12
==========================================
+ Hits 16193 16203 +10
- Misses 2042 2044 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Well done PR
Here as well I would like to have a feature toggle
admin/app/components/solidus_admin/tax_categories/edit/component.html.erb
Outdated
Show resolved
Hide resolved
e3e231d to
95d6b16
Compare
|
Dependency Notes:
|
|
@JustShah please rebase with latest main to fix the flaky test suite. Thanks 🙏🏻 |
95d6b16 to
23a48b0
Compare
|
@tvdeyen done |
|
@tvdeyen please Note the dependency on the other PR |
2797ee0 to
47e1410
Compare
…specs Introduce the `tax_reverse_charge_mode` enum to the `Spree::TaxCategory` model, with values `disabled`, `loose`, and `strict`. The change includes a migration to add the `tax_reverse_charge_mode` column to the `spree_tax_categories` table, with a default value of `0` (disabled). Additionally, the English locale file has been updated to include translations for the new enum values. The `tax_reverse_charge_mode` enum allows for more granular control over tax applicability based on the reverse charge status of an address. This enhancement improves the flexibility and accuracy of tax calculations by enabling different tax handling modes.
Includes updates to the admin interface to allow users to select the `tax_reverse_charge_mode` when creating or editing tax categories. The permitted parameters in the `TaxCategoriesController` have been updated to include `tax_reverse_charge_mode`. The admin views and components have been updated to display the `tax_reverse_charge_mode` in the tax categories index and form views. This ensures that users can easily manage and view the reverse charge mode for each tax category.
Enhanced the tax applicability logic by introducing the `tax_applicable?` method in the `Spree::Tax::TaxHelpers` module. The method determines if tax is applicable based on the `tax_reverse_charge_mode` of the tax category and the `reverse_charge_status` of the address. The `rates_for_item` method has been updated to use this new logic, ensuring that only applicable tax rates are selected. The `tax_applicable?` method supports three modes: - **strict**: Tax applies only if the address is not enabled. - **loose**: Tax applies only if the address is explicitly disabled. - **disabled**: Tax always applies.
47e1410 to
fa4d7a1
Compare
Important
Important
Blocked by #6168
Summary
Description
This pull request introduces enhancements to the tax applicability logic and updates the admin interface to support the new functionality.
Changes:
Tax Applicability Logic:
tax_applicable?method in theSpree::Tax::TaxHelpersmodule. This method determines if tax is applicable based on thetax_reverse_charge_modeof the tax category and thereverse_charge_statusof the address. Therates_for_itemmethod has been updated to use this new logic, ensuring that only applicable tax rates are selected.tax_applicable?method supports three modes:Admin Interface Updates:
tax_reverse_charge_modewhen creating or editing tax categories. The permitted parameters in theTaxCategoriesControllerhave been updated to includetax_reverse_charge_mode.tax_reverse_charge_modein the tax categories index and form views. This ensures that users can easily manage and view the reverse charge mode for each tax category.Model and Spec Updates:
tax_reverse_charge_modeenum to theSpree::TaxCategorymodel, with valuesdisabled,loose, andstrict. This change includes a migration to add thetax_reverse_charge_modecolumn to thespree_tax_categoriestable, with a default value of0(disabled). Additionally, the English locale file has been updated to include translations for the new enum values.tax_reverse_charge_modeis correctly validated and applied.The
tax_reverse_charge_modeenum allows for more granular control over tax applicability based on the reverse charge status of an address. This enhancement improves the flexibility and accuracy of tax calculations by enabling different tax handling modes. The updates to the admin interface ensure that users can easily manage and view the reverse charge mode for each tax category, providing a better user experience.Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: