From a5b2d50c4cde07d138894ee455726c3f1c764249 Mon Sep 17 00:00:00 2001 From: manu Date: Wed, 8 Mar 2023 13:16:06 +0100 Subject: [PATCH 1/2] [15.0][FIX]purchase_allowed_product: search product by vendor reference --- purchase_allowed_product/__manifest__.py | 2 +- .../views/purchase_order_views.xml | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/purchase_allowed_product/__manifest__.py b/purchase_allowed_product/__manifest__.py index 771cd1b4bb7..9c88585e25b 100644 --- a/purchase_allowed_product/__manifest__.py +++ b/purchase_allowed_product/__manifest__.py @@ -11,7 +11,7 @@ "website": "https://github.com/OCA/purchase-workflow", "author": "Akretion, Odoo Community Association (OCA)", "license": "AGPL-3", - "depends": ["purchase"], + "depends": ["purchase", "base_view_inheritance_extension"], "data": [ "views/res_partner_views.xml", "views/account_move_views.xml", diff --git a/purchase_allowed_product/views/purchase_order_views.xml b/purchase_allowed_product/views/purchase_order_views.xml index 810c2b0ed45..c5a65d010df 100644 --- a/purchase_allowed_product/views/purchase_order_views.xml +++ b/purchase_allowed_product/views/purchase_order_views.xml @@ -20,19 +20,19 @@ expr="//field[@name='order_line']/tree/field[@name='product_id']" position="attributes" > - { - 'restrict_supplier_id': parent.partner_id, - 'use_only_supplied_product': parent.use_only_supplied_product - } + + {'restrict_supplier_id': parent.partner_id, + 'use_only_supplied_product': parent.use_only_supplied_product} + - { - 'restrict_supplier_id': parent.partner_id, - 'use_only_supplied_product': parent.use_only_supplied_product - } + + {'restrict_supplier_id': parent.partner_id, + 'use_only_supplied_product': parent.use_only_supplied_product} + From a3d57a334ad4181f84dd71b2b599821c3681461d Mon Sep 17 00:00:00 2001 From: angel Date: Thu, 20 Apr 2023 15:57:44 +0200 Subject: [PATCH 2/2] [16.0][FIX] purchase_allowed_product: cannot find the vendor's products. --- purchase_allowed_product/models/product.py | 2 +- purchase_allowed_product/tests/test_purchase_allowed_product.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/purchase_allowed_product/models/product.py b/purchase_allowed_product/models/product.py index f627b4b79f8..d6f7e4839a7 100644 --- a/purchase_allowed_product/models/product.py +++ b/purchase_allowed_product/models/product.py @@ -27,7 +27,7 @@ def _search( .commercial_partner_id ) supplierinfos = self.env["product.supplierinfo"].search( - [("name", "=", seller.id)] + [("partner_id", "=", seller.id)] ) args += [ "|", diff --git a/purchase_allowed_product/tests/test_purchase_allowed_product.py b/purchase_allowed_product/tests/test_purchase_allowed_product.py index bc067fa90ef..dc8e0c7edcb 100644 --- a/purchase_allowed_product/tests/test_purchase_allowed_product.py +++ b/purchase_allowed_product/tests/test_purchase_allowed_product.py @@ -13,7 +13,7 @@ def setUp(self): self.product_model = self.env["product.product"] self.partner_4 = self.env.ref("base.res_partner_4") self.supplierinfo = self.supplierinfo_model.search( - [("name", "=", self.partner_4.id)] + [("partner_id", "=", self.partner_4.id)] ) self.partner_4_supplied_products = self.product_model.search( [