odoo/odoo#158516

Created by Ali Hassan Youssef (alhy)
Merged at 37ce3e57eea8a188090f57f812a608ef98564af5

Statuses:

label
odoo-dev:saas-17.1-opw-3796605-don't_clear_order_after_printing_bill-alhy
head
e1787261183675507b7e28da10552109b60e0b19
merged
1 year ago by POS IoT, Joseph Caburnay (jcb)
odoo/odoo
saas-17.1 #158516
saas-17.2 #159503
18.0
saas-18.1
saas-18.2
saas-18.3
saas-18.4
master #159530

[FIX] pos_restaurant: don't clear order after printing bill

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:

  • 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:
  • 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