[FIX] nfu_sale_order_batch_packaging: make sure every user can read the package

This commit is contained in:
Niels Göttsch 2025-09-20 09:24:16 +02:00 committed by madmooose
parent 8bf8e3ffe5
commit c9ce0d8cd9
5 changed files with 13 additions and 8 deletions

View file

@ -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
===========

View file

@ -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",

View file

@ -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)

View file

@ -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
- 1.3.6: make sure packages are readable by the user
- 1.3.7: really make sure packages are readable by the user

View file

@ -409,7 +409,8 @@ and adds a packaging default to sale order batch.</p>
</dl>
</li>
<li>1.3.4: store all quantities and round open values</li>
<li>1.3.5: make sure packages are readable by the user</li>
<li>1.3.6: make sure packages are readable by the user</li>
<li>1.3.7: really make sure packages are readable by the user</li>
</ul>
</div>
<div class="section" id="bug-tracker">