From e3289decaf95034f0ebba307350d3913a604eb8d Mon Sep 17 00:00:00 2001
From: "Hamza (hisl)" <hisl@odoo.com>
Date: Tue, 16 May 2023 15:06:02 +0000
Subject: [PATCH] [FIX] purchase : correct line id for invoice origin

Steps to reproduce:

1. Create a bill from document,
2. Fill in PO in auto complete, confirm, check the bills list.
3. The source document is not populated in the list.

What is the current behavior that you observe?
The source document is in the log, but does not show up in the dashboard.

What would be your expected behavior in this case?
The PO should show up in the source document in the list

OPW-3284992

closes odoo/odoo#121562

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
---
 addons/purchase/models/account_invoice.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/purchase/models/account_invoice.py b/addons/purchase/models/account_invoice.py
index 552c0123a439..3e6bb49b6f7a 100644
--- a/addons/purchase/models/account_invoice.py
+++ b/addons/purchase/models/account_invoice.py
@@ -65,7 +65,7 @@ class AccountMove(models.Model):
             )
 
         # Compute invoice_origin.
-        origins = set(self.line_ids.mapped('purchase_line_id.order_id.name'))
+        origins = set(self.invoice_line_ids.mapped('purchase_line_id.order_id.name'))
         self.invoice_origin = ','.join(list(origins))
 
         # Compute ref.
-- 
GitLab