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] pos_restaurant: don't clear order after printing bill #158516

Conversation

AH-Yussef
Copy link
Contributor

Steps to reproduce:

  • Install Restaurant app.
  • Go to Point of Sale app and open a new Restaurant session.
  • Add items to the order.
  • Click on the Bill button, the receipt window appears.
  • Click on the Print button, the print window appears. Cancel it - U don't have to print it or save it-.
  • Close the receipt window.
  • Add another item to the order, the older items are removed -the order is cleared-.

Investigation:

opw-3796605

Steps to reproduce:
- Install Restaurant app.
- Go to Point of Sale app and open a new Restaurant session.
- Add items to the order.
- Click on the Bill button, the reeceipt window appears.
- Click on the Print button, the print window appears. Cancel it - U don't have to print it or save it-.
- Close the reeceipt window.
- Add another item to the order, the older items are removed -the order is cleared-.

Investigation:
- When the Print button is clicked in the Bill Screen, `print()` method is triggered https://github.com/odoo/odoo/blob/c3fe6dfd3c56ae8058d0eb688680bdc627ee611a/addons/pos_restaurant/static/src/app/bill_screen/bill_screen.js#L16-L19
- which do two actions simultaneously:
	- calls the `printReceipt()` method https://github.com/odoo/odoo/blob/c3fe6dfd3c56ae8058d0eb688680bdc627ee611a/addons/pos_restaurant/static/src/app/bill_screen/bill_screen.js#L17
	- set the order.`_printed` to `false` https://github.com/odoo/odoo/blob/c3fe6dfd3c56ae8058d0eb688680bdc627ee611a/addons/pos_restaurant/static/src/app/bill_screen/bill_screen.js#L18 NOW order.`_printed` IS FALSE.
- Inside the `printReceipt()` method, we reach this line https://github.com/odoo/odoo/blob/c3fe6dfd3c56ae8058d0eb688680bdc627ee611a/addons/point_of_sale/static/src/app/store/pos_store.js#L1793 which set the order.`_printed` to True. NOW order.`_printed` IS TRUE.
- When a new product is added to the order, this if clause https://github.com/odoo/odoo/blob/c3fe6dfd3c56ae8058d0eb688680bdc627ee611a/addons/point_of_sale/static/src/app/store/models.js#L1871-L1875 is activated given that the order.`_printed` is true although it should have been false!

opw-3796605
@AH-Yussef AH-Yussef self-assigned this Mar 21, 2024
@robodoo
Copy link
Contributor

robodoo commented Mar 21, 2024

@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Mar 21, 2024
@adwid adwid requested a review from robinengels March 21, 2024 13:00
Copy link
Contributor

@robinengels robinengels left a comment

Choose a reason for hiding this comment

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

LGTM, could you add a test ? I think it should not be to difficult. Don't hesitate to ask me if you need help

@AH-Yussef
Copy link
Contributor Author

The explained behavior can't be tested!

Because an essential step is to Click on the Print button of the Bill screen, which opens the Browser print popup which can't be automatically closed by the test engine!

That results in the flow being stuck at the printReceipt method.

@AH-Yussef AH-Yussef marked this pull request as ready for review March 22, 2024 14:05
@C3POdoo C3POdoo requested review from a team and caburj and removed request for a team March 22, 2024 14:18
Copy link
Contributor

@caburj caburj left a comment

Choose a reason for hiding this comment

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

robodoo r+

robodoo pushed a commit that referenced this pull request Mar 27, 2024
Steps to reproduce:
- Install Restaurant app.
- Go to Point of Sale app and open a new Restaurant session.
- Add items to the order.
- Click on the Bill button, the reeceipt window appears.
- Click on the Print button, the print window appears. Cancel it - U don't have to print it or save it-.
- Close the reeceipt window.
- Add another item to the order, the older items are removed -the order is cleared-.

Investigation:
- When the Print button is clicked in the Bill Screen, `print()` method is triggered https://github.com/odoo/odoo/blob/c3fe6dfd3c56ae8058d0eb688680bdc627ee611a/addons/pos_restaurant/static/src/app/bill_screen/bill_screen.js#L16-L19
- which do two actions simultaneously:
	- calls the `printReceipt()` method https://github.com/odoo/odoo/blob/c3fe6dfd3c56ae8058d0eb688680bdc627ee611a/addons/pos_restaurant/static/src/app/bill_screen/bill_screen.js#L17
	- set the order.`_printed` to `false` https://github.com/odoo/odoo/blob/c3fe6dfd3c56ae8058d0eb688680bdc627ee611a/addons/pos_restaurant/static/src/app/bill_screen/bill_screen.js#L18 NOW order.`_printed` IS FALSE.
- Inside the `printReceipt()` method, we reach this line https://github.com/odoo/odoo/blob/c3fe6dfd3c56ae8058d0eb688680bdc627ee611a/addons/point_of_sale/static/src/app/store/pos_store.js#L1793 which set the order.`_printed` to True. NOW order.`_printed` IS TRUE.
- When a new product is added to the order, this if clause https://github.com/odoo/odoo/blob/c3fe6dfd3c56ae8058d0eb688680bdc627ee611a/addons/point_of_sale/static/src/app/store/models.js#L1871-L1875 is activated given that the order.`_printed` is true although it should have been false!

opw-3796605

closes #158516

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
@robodoo robodoo closed this Mar 27, 2024
@fw-bot
Copy link
Contributor

fw-bot commented Mar 31, 2024

@AH-Yussef @caburj this pull request has forward-port PRs awaiting action (not merged or closed):

5 similar comments
@fw-bot
Copy link
Contributor

fw-bot commented Apr 1, 2024

@AH-Yussef @caburj this pull request has forward-port PRs awaiting action (not merged or closed):

@fw-bot
Copy link
Contributor

fw-bot commented Apr 2, 2024

@AH-Yussef @caburj this pull request has forward-port PRs awaiting action (not merged or closed):

@fw-bot
Copy link
Contributor

fw-bot commented Apr 3, 2024

@AH-Yussef @caburj this pull request has forward-port PRs awaiting action (not merged or closed):

@fw-bot
Copy link
Contributor

fw-bot commented Apr 4, 2024

@AH-Yussef @caburj this pull request has forward-port PRs awaiting action (not merged or closed):

@fw-bot
Copy link
Contributor

fw-bot commented Apr 5, 2024

@AH-Yussef @caburj this pull request has forward-port PRs awaiting action (not merged or closed):

@fw-bot fw-bot deleted the saas-17.1-opw-3796605-don't_clear_order_after_printing_bill-alhy branch April 10, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OE the report is linked to a support ticket (opw-...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants