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

Fix supplier loading on Product & inventory report #12797

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rioug
Copy link
Collaborator

@rioug rioug commented Aug 21, 2024

What? Why?

I came across this when fixing #12768
Not all supplier are loaded in the "Product & inventory" report it's missing the suppliers of products distributed by the distributors the current user manages. As far as I could tell it wasn't covered by spec.

What should we test?

Set up an enterprise user that can manage another enterprise, and create an order cycle including the managed enterprise products. Place an order including at least one of the managed enterprise products.

As an admin

  • Visit Report page and choose Product & Inventory -> "All product"
  • Check the managed enterprise is included in the supplier dorpdown

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

The title of the pull request will be included in the release notes.

Dependencies

Documentation updates

Plus spec

Left over from product refactor, it was missed because it's not covered
by unit or integration test
@rioug rioug added the user facing changes Thes pull requests affect the user experience label Aug 21, 2024
Copy link
Member

@mkllnk mkllnk left a comment

Choose a reason for hiding this comment

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

Nice cleanup. I hope that nobody will be confused by additional data in the report. This may need running past the product team. Kirsten had doubts about the use of this report, didn't she?

Anyway, it seems a good change.

@RachL
Copy link
Contributor

RachL commented Aug 23, 2024

@mkllnk @rioug Kirsten was speaking about the bulk coop report.

Here I guess if no one has reported it, that the report is rarely used, but maybe this bug also prevented the use of it? If I understand clearly, a distributor with no product, but managing it's suppliers would never see data on it.

It makes sense to me that we show the data the user has access to. Otherwise we should hide the report from them. So I'm ok with moving forward with that PR 👍

Copy link
Member

@dacook dacook left a comment

Choose a reason for hiding this comment

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

Great, I can see this is fixed thanks to the spec 💪

From what I understand, it is now meant to be more accurate, and will now show only suppliers that I have distributed products for? Instead of all suppliers that I have access to?
I don't see this new feature covered in the spec, but I don't know enough to judge how important it is...

@rioug
Copy link
Collaborator Author

rioug commented Aug 26, 2024

The part that I fixed only affect the supplier dropdown, it should not display additional data in the report. It means that before a user was not able to filter by supplier from a product distributed by the distributor.
It looks like it's not used much, no one has complained about it.

@filipefurtad0
Copy link
Contributor

It looks like it's not used much,

Opened an issue to track this here.

@drummer83 drummer83 self-assigned this Sep 27, 2024
@drummer83 drummer83 added the pr-staged-au staging.openfoodnetwork.org.au label Sep 27, 2024
@drummer83
Copy link
Contributor

Work in Progress

Managing Permissions Distributor dropdown Supplier dropdown Results with no filter
Producer 1 AU Producer 1 AU Producer 1 AU Products of ...
Producer 1 AU + Producer 3 AU No Permissions Producer 1 AU + Producer 3 AU Supplier 1 AU
Producer 1 AU + Producer 3 AU Permission to add to Order Cycles Producer 1 AU + Producer 3 AU Producer 1 AU + Producer 3 AU

Before

  • User: producer@ko...
  • Managing only 1 enterprise (Producer 1 AU)
    • Distributor dropdown: only Producer 1 AU available
    • Supplier dropdown: only Producer 1 AU available
    • Results with no filter:
      • Products of Producer 1 AU are shown
      • Products of Konrad Producer 5 AU are shown (through enterprise permissions)
    • Results with supplier filter for Producer 1 AU
      • Products of Producer 1 AU are shown
  • Managing a 2nd enterprise (Producer 1 AU + Producer 3 AU) with permission to add to order cycle
    • Distributor dropdown: Producer 1 AU + Producer 3 AU available
    • Supplier dropdown: Producer 1 AU + Producer 3 AU available
    • Results with no filter:
      • Products of Producer 1 AU are shown
      • Products of Konrad Producer 5 AU are shown (through enterprise permissions)
      • Products of Producer 3 AU are shown (through enterprise managing)
  • Managing a 2nd enterprise (Producer 1 AU + Producer 3 AU) WITHOUT permission to add to order cycle
    • Distributor dropdown: Producer 1 AU + Producer 3 AU available
    • Supplier dropdown: Producer 1 AU available
    • Results with no filter:
      • Products of Producer 1 AU are shown
      • Products of Konrad Producer 5 AU are shown (through enterprise permissions)
      • Products of Producer 3 AU are shown (through enterprise managing)

Check that enterprise is removed from supplier dropdown when set to non-producer.

@filipefurtad0 filipefurtad0 removed the pr-staged-au staging.openfoodnetwork.org.au label Sep 27, 2024
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: Test Ready 🧪
Development

Successfully merging this pull request may close these issues.

6 participants