From 1ac5f5ca106552b2355ba29c86a144d4709f86d2 Mon Sep 17 00:00:00 2001 From: Alessio Renda Date: Wed, 25 Oct 2023 10:40:25 +0200 Subject: [PATCH] [FIX] account_invoice_inter_company: Remove self company from eligible companies in `_find_company_from_invoice_partner` --- account_invoice_inter_company/models/account_move.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/account_invoice_inter_company/models/account_move.py b/account_invoice_inter_company/models/account_move.py index 7ca55f41108..2c34e80e43f 100644 --- a/account_invoice_inter_company/models/account_move.py +++ b/account_invoice_inter_company/models/account_move.py @@ -31,7 +31,13 @@ def _find_company_from_invoice_partner(self): company = ( self.env["res.company"] .sudo() - .search([("partner_id", "=", self.commercial_partner_id.id)], limit=1) + .search( + [ + ("partner_id", "=", self.commercial_partner_id.id), + ("id", "!=", self.company_id.id), + ], + limit=1, + ) ) return company or False