From c9ce0d8cd9d7f1085590c55d17c1cf4d21475f0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20G=C3=B6ttsch?= Date: Sat, 20 Sep 2025 09:24:16 +0200 Subject: [PATCH] [FIX] nfu_sale_order_batch_packaging: make sure every user can read the package --- nfu_sale_order_batch_packaging/README.rst | 3 ++- nfu_sale_order_batch_packaging/__manifest__.py | 2 +- .../models/sale_order_line.py | 10 ++++++---- nfu_sale_order_batch_packaging/readme/HISTORY.rst | 3 ++- .../static/description/index.html | 3 ++- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/nfu_sale_order_batch_packaging/README.rst b/nfu_sale_order_batch_packaging/README.rst index 1ab8377..af2f01b 100644 --- a/nfu_sale_order_batch_packaging/README.rst +++ b/nfu_sale_order_batch_packaging/README.rst @@ -48,7 +48,8 @@ Changelog - store open_packaging_qty on batch product module to make it sortable - always adjust max_qty to be at least uom_qty except you only set max qty - 1.3.4: store all quantities and round open values -- 1.3.5: make sure packages are readable by the user +- 1.3.6: make sure packages are readable by the user +- 1.3.7: really make sure packages are readable by the user Bug Tracker =========== diff --git a/nfu_sale_order_batch_packaging/__manifest__.py b/nfu_sale_order_batch_packaging/__manifest__.py index 627b420..f8cd38b 100644 --- a/nfu_sale_order_batch_packaging/__manifest__.py +++ b/nfu_sale_order_batch_packaging/__manifest__.py @@ -4,7 +4,7 @@ "author": "BAKEUP", "website": "https://www.bakeup.org", "category": "Sale", - "version": "16.0.1.3.6", + "version": "16.0.1.3.7", "depends": ["sale", "sale_order_batch"], "data": [ "data/ir_config_parameter.xml", diff --git a/nfu_sale_order_batch_packaging/models/sale_order_line.py b/nfu_sale_order_batch_packaging/models/sale_order_line.py index c7d927f..4a5bc0c 100644 --- a/nfu_sale_order_batch_packaging/models/sale_order_line.py +++ b/nfu_sale_order_batch_packaging/models/sale_order_line.py @@ -42,10 +42,12 @@ class SaleOrderLine(models.Model): product_id = vals.get("product_id") # Make sure we're not sudo # e.x. when comming from webshop - packaging = ( - self.env["product.packaging"] - .with_user(self.env.user) - .search([("product_id", "=", product_id)], limit=1) + packaging = self.env["product.packaging"].search( + [ + ("product_id", "=", product_id), + ("company_id", "in", [False, self.env.company.id]), + ], + limit=1, ) vals["product_packaging_id"] = packaging.id return super().create(vals_list) diff --git a/nfu_sale_order_batch_packaging/readme/HISTORY.rst b/nfu_sale_order_batch_packaging/readme/HISTORY.rst index c30d813..53a9977 100644 --- a/nfu_sale_order_batch_packaging/readme/HISTORY.rst +++ b/nfu_sale_order_batch_packaging/readme/HISTORY.rst @@ -13,4 +13,5 @@ - store open_packaging_qty on batch product module to make it sortable - always adjust max_qty to be at least uom_qty except you only set max qty - 1.3.4: store all quantities and round open values -- 1.3.5: make sure packages are readable by the user \ No newline at end of file +- 1.3.6: make sure packages are readable by the user +- 1.3.7: really make sure packages are readable by the user \ No newline at end of file diff --git a/nfu_sale_order_batch_packaging/static/description/index.html b/nfu_sale_order_batch_packaging/static/description/index.html index 33e4833..e6ea5de 100644 --- a/nfu_sale_order_batch_packaging/static/description/index.html +++ b/nfu_sale_order_batch_packaging/static/description/index.html @@ -409,7 +409,8 @@ and adds a packaging default to sale order batch.

  • 1.3.4: store all quantities and round open values
  • -
  • 1.3.5: make sure packages are readable by the user
  • +
  • 1.3.6: make sure packages are readable by the user
  • +
  • 1.3.7: really make sure packages are readable by the user