[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 <pimodoo@users.noreply.github.com>
This commit is contained in:
committed by
Pierre Masereel
parent
20c097996e
commit
71e9c4dc7a
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user