From e5aee1fcbf7d52ea05ce674c9371c2f75a60a33e Mon Sep 17 00:00:00 2001 From: "Maruan Aguerdouh (magm)" Date: Tue, 20 Dec 2022 10:22:22 +0000 Subject: [PATCH] [FIX] website_sale_picking: picking right warehouse without error Steps to reproduce the bug: - Get the website module. - Go to Settings > Website > Shipping. - Activate "On Site Payments & Picking" and save. - Go to the same setting again and click on "Customize Pickup Sites". - Pick the only delivery method that exists. - Inside the delivery method, select a warehouse of the current company and try to save. Issue: We won't be able to add a warehouse as the hidden field of the `company_id` is not set. Solution: We modified the if statement inside `_check_warehouse_company` in order to accept companies. opw-3097424 closes odoo/odoo#112696 X-original-commit: dc8c24a5ace17382f54ad256b0ef585e24bca7ca Signed-off-by: William Braeckman (wbr) --- addons/website_sale_picking/models/delivery_carrier.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_sale_picking/models/delivery_carrier.py b/addons/website_sale_picking/models/delivery_carrier.py index 3d2eac2a42e..fd661187737 100644 --- a/addons/website_sale_picking/models/delivery_carrier.py +++ b/addons/website_sale_picking/models/delivery_carrier.py @@ -19,7 +19,7 @@ class DeliveryCarrier(models.Model): @api.constrains('warehouse_id', 'company_id') def _check_warehouse_company(self): for carrier in self: - if carrier.warehouse_id.company_id and carrier.company_id != carrier.warehouse_id.company_id: + if carrier.warehouse_id.company_id and carrier.company_id and carrier.company_id != carrier.warehouse_id.company_id: raise ValidationError(_("The picking site and warehouse must share the same company")) def onsite_rate_shipment(self, order):