[FIX] pos_restaurant: Error when adding product after printing the bill

Issue

	- Install "Point of sale"
	- Create a new one.
	- Activate the "Is a Bar/Restaurant" feature and save
	- Activate the "Bill Printing" feature then save
	- Start a new session
	- Add a product A
	- Click on "Bill" then "Print"
	- Then click on "Ok" to go back to order
	- Add a product B

	Error is raised ("Cannot read property 'add_product' of null").

Cause

	Trying to add a product to an order who is destroyed
	if the bill has been printed.

Solution

	If the bill is printed (and not the receipt), set '_printed' of
	the current order to 'false', therefore it will add the product
	to the current order.

opw-2341115

closes odoo/odoo#59465

X-original-commit: 6683a9929d68be956854000fa9b3e9f99ceecdfb
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
This commit is contained in:
Nasreddin (bon)
2020-10-08 08:28:01 +00:00
parent c24c2338ac
commit 5c27b57ef9
@@ -20,6 +20,13 @@ odoo.define('pos_restaurant.ReceiptScreen', function(require) {
return super.nextScreen;
}
}
/**
* @override
*/
async _printWeb() {
await super._printWeb();
this.currentOrder._printed = false;
}
};
Registries.Component.extend(ReceiptScreen, PosResReceiptScreen);