[FIX] point_of_sale: use journal account when income account is missing

Prior to this commit, when the product income account was absent, and
the product category income account was also missing, PoS would fail to
create an invoice. Now, it correctly utilizes the PoS config journal
default account.

opw-3615194

closes odoo/odoo#149816

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
Pedram (pebr)
2024-01-23 00:52:39 +00:00
parent 956cd636b0
commit e18a2daa42
+1 -1
View File
@@ -1512,7 +1512,7 @@ class PosOrderLine(models.Model):
commercial_partner = self.order_id.partner_id.commercial_partner_id
fiscal_position = self.order_id.fiscal_position_id
line = line.with_company(self.order_id.company_id)
account = line.product_id._get_product_accounts()['income']
account = line.product_id._get_product_accounts()['income'] or self.order_id.config_id.journal_id.default_account_id
if not account:
raise UserError(_(
"Please define income account for this product: '%s' (id:%d).",