From 71e9c4dc7a3a1839290801e963ca9dc15f31eb76 Mon Sep 17 00:00:00 2001 From: Gert Pellin Date: Mon, 9 Sep 2019 11:29:52 +0000 Subject: [PATCH] [FIX] point_of_sale: close session in multi company Close a rescue PoS Session from another company triggers this error: "Please define income account for this product: "Office Chair" (id:5). property_account_income_id on product is company dependent but no company was forced before this fix. closes odoo/odoo#36280 Signed-off-by: pimodoo --- addons/point_of_sale/models/pos_session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index adaab34ad08..14ccea3d461 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -521,7 +521,7 @@ class PosSession(models.Model): """ def get_income_account(order_line): product = order_line.product_id - income_account = product.property_account_income_id or product.categ_id.property_account_income_categ_id + income_account = product.with_context(force_company=order_line.company_id.id).property_account_income_id or product.categ_id.with_context(force_company=order_line.company_id.id).property_account_income_categ_id if not income_account: raise UserError(_('Please define income account for this product: "%s" (id:%d).') % (product.name, product.id))