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] point_of_sale: restrict refund button until qty selected on ticket screen #165180

Conversation

jipr-odoo
Copy link
Contributor

@jipr-odoo jipr-odoo commented May 13, 2024

Before this commit:

When clicking the refund button without selecting the quantity for the selected
order lines, the ticket screen would redirect to the product screen, resulting
in empty order lines.

After this commit:

The refund button will not redirect the ticket screen to the product screen
until a quantity is selected for the selected order line.

Task ID: 3922007

@robodoo
Copy link
Contributor

robodoo commented May 13, 2024

@C3POdoo C3POdoo added the RD research & development, internal work label May 13, 2024
@jipr-odoo jipr-odoo force-pushed the saas-17.1-point_of_sale-restrict-refund-button-fix-jipr branch 4 times, most recently from c5c4c8d to f3b720d Compare May 15, 2024 04:48
@jipr-odoo jipr-odoo changed the title [FIX] point_of_sale: restrict refund button when qty not select on ticketscreen [FIX] point_of_sale: restrict refund button until qty selected on ticket screen May 15, 2024
@jipr-odoo jipr-odoo marked this pull request as ready for review May 15, 2024 12:43
@C3POdoo C3POdoo requested review from a team and adgu-odoo and removed request for a team May 15, 2024 13:00
Copy link
Contributor

@adgu-odoo adgu-odoo left a comment

Choose a reason for hiding this comment

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

This is not a bad change but can you we have a method getHasItemsToRefund in the ticket_screen. Maybe a good change would be to use it at the start of the method. If this returns false, you just return without doing anything. This in addition with not putting the class bg-primary if the isActionButtonHighlighted props on the action_pad is false would lead to the user knowing if he can or not click on the refund button. What do you think ?

@jipr-odoo
Copy link
Contributor Author

This is not a bad change but can you we have a method getHasItemsToRefund in the ticket_screen. Maybe a good change would be to use it at the start of the method. If this returns false, you just return without doing anything. This in addition with not putting the class bg-primary if the isActionButtonHighlighted props on the action_pad is false would lead to the user knowing if he can or not click on the refund button. What do you think ?

Hello @adgu-odoo , yes i agree with your suggestion , we can use getHasItemsToRefund() to return nothing when qty not selected for orderline , with this method we don't need highlightHeaderNote state anymore so we can remove that.

Also for isActionButtonHighlighted props on the action_pad we cannot disable the button for user as per discuss with PO here,
I think using getHasItemsToRefund() is sufficient to restrict the button from redirecting and displaying the text in red to prompt the user to enter the quantity. What do you suggest? Should I make this change?

@adgu-odoo
Copy link
Contributor

This is not a bad change but can you we have a method getHasItemsToRefund in the ticket_screen. Maybe a good change would be to use it at the start of the method. If this returns false, you just return without doing anything. This in addition with not putting the class bg-primary if the isActionButtonHighlighted props on the action_pad is false would lead to the user knowing if he can or not click on the refund button. What do you think ?

Hello @adgu-odoo , yes i agree with your suggestion , we can use getHasItemsToRefund() to return nothing when qty not selected for orderline , with this method we don't need highlightHeaderNote state anymore so we can remove that.

Also for isActionButtonHighlighted props on the action_pad we cannot disable the button for user as per discuss with PO here, I think using getHasItemsToRefund() is sufficient to restrict the button from redirecting and displaying the text in red to prompt the user to enter the quantity. What do you suggest? Should I make this change?

Yeah that seems to be a good change. I do not understand why we cannot disable the button. However, if this button cannot be disabled, we should remove the isActionButtonHighlighted props (in master) as it is not used.

@jipr-odoo
Copy link
Contributor Author

This is not a bad change but can you we have a method getHasItemsToRefund in the ticket_screen. Maybe a good change would be to use it at the start of the method. If this returns false, you just return without doing anything. This in addition with not putting the class bg-primary if the isActionButtonHighlighted props on the action_pad is false would lead to the user knowing if he can or not click on the refund button. What do you think ?

Hello @adgu-odoo , yes i agree with your suggestion , we can use getHasItemsToRefund() to return nothing when qty not selected for orderline , with this method we don't need highlightHeaderNote state anymore so we can remove that.
Also for isActionButtonHighlighted props on the action_pad we cannot disable the button for user as per discuss with PO here, I think using getHasItemsToRefund() is sufficient to restrict the button from redirecting and displaying the text in red to prompt the user to enter the quantity. What do you suggest? Should I make this change?

Yeah that seems to be a good change. I do not understand why we cannot disable the button. However, if this button cannot be disabled, we should remove the isActionButtonHighlighted props (in master) as it is not used.

Hello @adgu-odoo , we can make the button from btn-primary to btn-secondary in this case without disabling the button,
this will prompt the user to enter the quantity

@jipr-odoo jipr-odoo force-pushed the saas-17.1-point_of_sale-restrict-refund-button-fix-jipr branch from f3b720d to 4403691 Compare May 17, 2024 10:10
@jipr-odoo
Copy link
Contributor Author

Hello @adgu-odoo
Changes are done, can you please check again ?
Thanks!

Copy link
Contributor

@adgu-odoo adgu-odoo left a comment

Choose a reason for hiding this comment

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

I like what you did, can you just address my comment and it should be good to r+

@@ -12,7 +12,8 @@
partner="partner"
actionName="constructor.numpadActionName"
actionType="'payment'"
onClickMore.bind="displayAllControlPopup" />
onClickMore.bind="displayAllControlPopup"
isActionButtonHighlighted="items"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Putting items there is not the best. Try with refunding a product: when clicking on refund, an order will be created with an orderline of quantity -1. If you click on a product, it will add a line with quantity 1 and the items getter will return 0 so the button will not be highlighted but it should be.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for bringing to my attention that I missed this particular case.

…ket screen

Before this commit:
===================
When clicking the refund button without selecting the quantity for the selected
order lines, the ticket screen would redirect to the product screen, resulting
in empty order lines.

After this commit:
The refund button will not redirect the ticket screen to the product screen
until a quantity is selected for the selected order line.

Task ID: 3922007
@jipr-odoo jipr-odoo force-pushed the saas-17.1-point_of_sale-restrict-refund-button-fix-jipr branch from 4403691 to 07f4e7e Compare May 17, 2024 12:25
@adgu-odoo
Copy link
Contributor

@robodoo r+

robodoo pushed a commit that referenced this pull request May 17, 2024
…ket screen

Before this commit:
===================
When clicking the refund button without selecting the quantity for the selected
order lines, the ticket screen would redirect to the product screen, resulting
in empty order lines.

After this commit:
The refund button will not redirect the ticket screen to the product screen
until a quantity is selected for the selected order line.

Task ID: 3922007

closes #165180

Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
@robodoo robodoo closed this May 17, 2024
@fw-bot
Copy link
Contributor

fw-bot commented May 21, 2024

@jipr-odoo @adgu-odoo this pull request has forward-port PRs awaiting action (not merged or closed):

@fw-bot
Copy link
Contributor

fw-bot commented May 22, 2024

@jipr-odoo @adgu-odoo this pull request has forward-port PRs awaiting action (not merged or closed):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants