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
[FIX] pos_restaurant: don't clear order after printing bill #158516
Conversation
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
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.
LGTM, could you add a test ? I think it should not be to difficult. Don't hesitate to ask me if you need help
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 |
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.
robodoo r+
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>
@AH-Yussef @caburj this pull request has forward-port PRs awaiting action (not merged or closed): |
5 similar comments
@AH-Yussef @caburj this pull request has forward-port PRs awaiting action (not merged or closed): |
@AH-Yussef @caburj this pull request has forward-port PRs awaiting action (not merged or closed): |
@AH-Yussef @caburj this pull request has forward-port PRs awaiting action (not merged or closed): |
@AH-Yussef @caburj this pull request has forward-port PRs awaiting action (not merged or closed): |
@AH-Yussef @caburj this pull request has forward-port PRs awaiting action (not merged or closed): |
Steps to reproduce:
Investigation:
print()
method is triggeredodoo/addons/pos_restaurant/static/src/app/bill_screen/bill_screen.js
Lines 16 to 19 in c3fe6df
printReceipt()
methododoo/addons/pos_restaurant/static/src/app/bill_screen/bill_screen.js
Line 17 in c3fe6df
_printed
tofalse
odoo/addons/pos_restaurant/static/src/app/bill_screen/bill_screen.js
Line 18 in c3fe6df
_printed
IS FALSE.printReceipt()
method, we reach this lineodoo/addons/point_of_sale/static/src/app/store/pos_store.js
Line 1793 in c3fe6df
_printed
to True. NOW order._printed
IS TRUE.odoo/addons/point_of_sale/static/src/app/store/models.js
Lines 1871 to 1875 in c3fe6df
_printed
is true although it should have beenfalse
!opw-3796605