diff --git a/models/pos_session.py b/models/pos_session.py index 96fa64a..92f171d 100644 --- a/models/pos_session.py +++ b/models/pos_session.py @@ -12,7 +12,7 @@ class PosSession(models.Model): """Override to allow products without income accounts when payment methods have them configured""" def get_income_account(order_line): product = order_line.product_id - income_account = product.with_company(order_line.company_id)._get_product_accounts()['income'] or self.config_id.journal_id.default_account_id + income_account = product.with_company(order_line.company_id)._get_product_accounts()['income'] or (self and self[0].config_id.journal_id.default_account_id or False) # NEW: If no income account is found on the product, check if payment methods have income accounts configured if not income_account: @@ -59,7 +59,7 @@ class PosSession(models.Model): if not sales: return data - discount_product_id = self.config_id.discount_product_id.id if self.config_id.discount_product_id else None + discount_product_id = self[0].config_id.discount_product_id.id if self and self[0].config_id.discount_product_id else None # Build per-order breakdown of sales keyed by (account, sign, tax tuple, tags) order_payment_totals = {}