From b450faf4f9d9eea2c8edf628de136345d65d398b Mon Sep 17 00:00:00 2001
From: bosd <5e2fd43-d292-4c90-9d1f-74ff3436329a@anonaddy.me>
Date: Thu, 11 Jun 2026 09:03:01 +0200
Subject: [PATCH] [FIX] contract: exclude archived products from the contract
line picker
---
contract/models/contract_template_line.py | 6 +++++-
contract/views/contract_line.xml | 9 ++++++---
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/contract/models/contract_template_line.py b/contract/models/contract_template_line.py
index 607d32e4a0..4a1b11babd 100644
--- a/contract/models/contract_template_line.py
+++ b/contract/models/contract_template_line.py
@@ -33,7 +33,11 @@ class ContractTemplateLine(models.Model):
comodel_name="res.partner", related="contract_id.partner_id"
)
# === Product & UOM ===
- product_id = fields.Many2one("product.product", string="Product")
+ product_id = fields.Many2one(
+ "product.product",
+ string="Product",
+ domain=[("active", "=", True)],
+ )
name = fields.Text(
string="Description",
required=True,
diff --git a/contract/views/contract_line.xml b/contract/views/contract_line.xml
index b3c9d88c29..6c62c84ae5 100644
--- a/contract/views/contract_line.xml
+++ b/contract/views/contract_line.xml
@@ -51,7 +51,9 @@
- [('sale_ok', '=', True)]
+ [('sale_ok', '=', True), ('active', '=', True)]
@@ -65,8 +67,9 @@
- [('purchase_ok', '=', True)]
-
+ [('purchase_ok', '=', True), ('active', '=', True)]
True