Skip to content
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

Add 'tax category' to the All Products report #13018

Conversation

chahmedejaz
Copy link
Collaborator

@chahmedejaz chahmedejaz commented Dec 3, 2024

⚠️ Please use clockify code #12476 Flower Farms

What? Why?

What should we test?

  • As mentioned in the issue

Release notes

Changelog Category (reviewers may add a label for the release notes):

  • User facing changes
  • API changes (V0, V1, DFC or Webhook)
  • Technical changes only
  • Feature toggled

@chahmedejaz chahmedejaz added user facing changes Thes pull requests affect the user experience funded feature and removed funded feature labels Dec 3, 2024
@chahmedejaz chahmedejaz force-pushed the task/13008-add-tax-category-in-all-products-report branch from 8da296d to c331d57 Compare December 3, 2024 22:36
@@ -19,7 +25,8 @@ def columns
super.merge(
{
on_demand: proc{ |variant| variant.on_demand },
on_hand: proc{ |variant| variant.on_demand ? I18n.t(:on_demand) : variant.on_hand }
on_hand: proc{ |variant| variant.on_demand ? I18n.t(:on_demand) : variant.on_hand },
tax_category: proc { |variant| variant.tax_category_id && variant.tax_category.name }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tax_category returns the default TaxCategory if the variant doesn't have one.
That's why we need to ensure that this tax category value maps to the variant's assigned tax category, rather than the default one.
This is the whole purpose of the addition of this field in the report.

@chahmedejaz chahmedejaz marked this pull request as ready for review December 3, 2024 22:45
@rioug rioug self-requested a review December 3, 2024 22:49
Copy link
Collaborator

@rioug rioug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@filipefurtad0 filipefurtad0 self-assigned this Dec 9, 2024
@filipefurtad0 filipefurtad0 added the pr-staged-au staging.openfoodnetwork.org.au label Dec 9, 2024
@filipefurtad0
Copy link
Contributor

Hey @chahmedejaz,

I've checked the acceptance criteria from the issue:

  • Logging in as an enterprise and visiting to /admin/reports/products_and_inventory/all_products -> access the report page. The report renders as before:

image

  • Verified that the "tax category" column is not selected by default:

image

  • Selecting the column from the dropdown displays the respective tax category

image

  • If there is no tax category associated with a product, then the report renders and None is displayed. Bonus points, this is a translatable string:

image

Ok, so indeed now the report easily allows identifying the products which are missing tax categories. However, as displayed in the pic above, the string is not translatable, on the report page (right side). We can see, that on the products page, this is the case, so the strings' translation is available on Transifex. I'll open an issue to address this. (This is also the case with the column Group Buy Unit Quantity).

Other than this minor glitch, the PR looks fine - I'll merge this now, so we include it on the latest release.

@filipefurtad0 filipefurtad0 removed the pr-staged-au staging.openfoodnetwork.org.au label Dec 9, 2024
@filipefurtad0 filipefurtad0 merged commit 6e40e4d into openfoodfoundation:master Dec 9, 2024
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user facing changes Thes pull requests affect the user experience
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add 'tax category' to the All Products report
4 participants