From 9eb525e52c72a0cd137913baefb186d3d607023d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Granda=20Mart=C3=ADnez?= Date: Mon, 13 Jan 2025 16:24:58 +0100 Subject: [PATCH] =?UTF-8?q?Arreglar=20compute=20a=20la=20hora=20de=20a?= =?UTF-8?q?=C3=B1adir=20proveedores=20a=20los=20productos=20(#57)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- purchase_portal/controllers/prequest_json.py | 4 ++-- purchase_portal/models/product_supplierinfo.py | 5 ++++- purchase_portal/templates/purchase_request.xml | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/purchase_portal/controllers/prequest_json.py b/purchase_portal/controllers/prequest_json.py index 04ddf2f..4e8f592 100644 --- a/purchase_portal/controllers/prequest_json.py +++ b/purchase_portal/controllers/prequest_json.py @@ -86,8 +86,8 @@ def get_purchase_request_product_table(self, **kw): product_ids = request.env["product.product"].sudo().search([ ("id", "in", product_ids.ids), "|", - ("seller_ids.name", "in", [partner_id.name]), - ("seller_ids.name", "in", [commercial_partner_id.name]) + ("seller_ids.name", "=", partner_id.id), + ("seller_ids.name", "=", commercial_partner_id.id) ]) if request.env.user.banned_product_ids: diff --git a/purchase_portal/models/product_supplierinfo.py b/purchase_portal/models/product_supplierinfo.py index d8c6025..9c19142 100644 --- a/purchase_portal/models/product_supplierinfo.py +++ b/purchase_portal/models/product_supplierinfo.py @@ -34,7 +34,10 @@ class ProductSupplierinfo(models.Model): @api.depends('name') def _compute_seller_children_ids(self): for record in self: - record.seller_children_ids = self.env['res.partner'].search([('parent_id', '=', record.name.id)]) + if record.name: + record.seller_children_ids = self.env['res.partner'].search([('parent_id', '=', record.name.id)]) + else: + record.seller_children_ids = False @api.model def create(self, values): diff --git a/purchase_portal/templates/purchase_request.xml b/purchase_portal/templates/purchase_request.xml index 8355914..1fcc25b 100644 --- a/purchase_portal/templates/purchase_request.xml +++ b/purchase_portal/templates/purchase_request.xml @@ -340,7 +340,7 @@
-
+