From 6caf64e2c2e372965a71adf2735b3be7b7e41f34 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Mon, 4 Dec 2023 21:29:59 +0100 Subject: [PATCH 1/2] [FIX] joint_buying_sale : correct compute sudo, to display correctly transport request, on sale.order --- joint_buying_sale/models/sale_order.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/joint_buying_sale/models/sale_order.py b/joint_buying_sale/models/sale_order.py index 28fdfa61..ef9d8549 100644 --- a/joint_buying_sale/models/sale_order.py +++ b/joint_buying_sale/models/sale_order.py @@ -24,9 +24,10 @@ class SaleOrder(models.Model): @api.depends("joint_buying_transport_request_ids") def _compute_joint_buying_transport_request_id(self): - for order in self.sudo(): + for order in self: + sudo_order = order.sudo() order.joint_buying_transport_request_id = ( - order.joint_buying_transport_request_ids - and order.joint_buying_transport_request_ids[0] + sudo_order.joint_buying_transport_request_ids + and sudo_order.joint_buying_transport_request_ids[0] or False ) From 82ad6837c98d5564b59452d660f46dfea77c7c3f Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Thu, 7 Dec 2023 10:12:47 +0100 Subject: [PATCH 2/2] [FIX] joint_buying_sale : use compute_sudo. (why ? I don't remember exactly, sorry dude) --- joint_buying_sale/models/sale_order.py | 1 + 1 file changed, 1 insertion(+) diff --git a/joint_buying_sale/models/sale_order.py b/joint_buying_sale/models/sale_order.py index ef9d8549..8fb8b999 100644 --- a/joint_buying_sale/models/sale_order.py +++ b/joint_buying_sale/models/sale_order.py @@ -11,6 +11,7 @@ class SaleOrder(models.Model): joint_buying_transport_request_id = fields.Many2one( comodel_name="joint.buying.transport.request", compute="_compute_joint_buying_transport_request_id", + compute_sudo=True, ) joint_buying_transport_request_ids = fields.One2many(