[FIX] nfu_sale_order_batch: make sure packages are readable by the user
This commit is contained in:
parent
bf3eed8669
commit
dbc3b32ecd
5 changed files with 50 additions and 64 deletions
|
|
@ -33,21 +33,22 @@ and adds a packaging default to sale order batch.
|
||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
:0.0.1: Initial module.
|
- 0.0.1: Initial module.
|
||||||
:1.0.0: rename to nfu_sale_order_batch_packaging
|
- 1.0.0: rename to nfu_sale_order_batch_packaging
|
||||||
:1.1.0: Live
|
- 1.1.0: Live
|
||||||
:1.2.0: Add regeneration action for batch products
|
- 1.2.0: Add regeneration action for batch products
|
||||||
:1.2.1: refactoring
|
- 1.2.1: refactoring
|
||||||
:1.3.0: add packaging states
|
- 1.3.0: add packaging states
|
||||||
:1.3.1: add open_max_qty
|
- 1.3.1: add open_max_qty
|
||||||
:1.3.2: fix color indicator
|
- 1.3.2: fix color indicator
|
||||||
:1.3.3: Enable packagings on installation
|
- 1.3.3: Enable packagings on installation
|
||||||
:1.3.4:
|
- 1.3.4:
|
||||||
- on creation set max_qty to product_uom_qty if not set
|
- on creation set max_qty to product_uom_qty if not set
|
||||||
- remove zero exception for max_qty
|
- remove zero exception for max_qty
|
||||||
- store open_packaging_qty on batch product module to make it sortable
|
- 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
|
- 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.4: store all quantities and round open values
|
||||||
|
- 1.3.5: make sure packages are readable by the user
|
||||||
|
|
||||||
Bug Tracker
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"author": "BAKEUP",
|
"author": "BAKEUP",
|
||||||
"website": "https://www.bakeup.org",
|
"website": "https://www.bakeup.org",
|
||||||
"category": "Sale",
|
"category": "Sale",
|
||||||
"version": "16.0.1.3.5",
|
"version": "16.0.1.3.6",
|
||||||
"depends": ["sale", "sale_order_batch"],
|
"depends": ["sale", "sale_order_batch"],
|
||||||
"data": [
|
"data": [
|
||||||
"data/ir_config_parameter.xml",
|
"data/ir_config_parameter.xml",
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,12 @@ class SaleOrderLine(models.Model):
|
||||||
vals["product_uom_max_qty"] = product_qty
|
vals["product_uom_max_qty"] = product_qty
|
||||||
if vals.get("product_id") and not vals.get("product_packaging_id"):
|
if vals.get("product_id") and not vals.get("product_packaging_id"):
|
||||||
product_id = vals.get("product_id")
|
product_id = vals.get("product_id")
|
||||||
packaging = self.env["product.packaging"].search(
|
# Make sure we're not sudo
|
||||||
[("product_id", "=", product_id)], limit=1
|
# e.x. when comming from webshop
|
||||||
|
packaging = (
|
||||||
|
self.env["product.packaging"]
|
||||||
|
.with_user(self.env.user)
|
||||||
|
.search([("product_id", "=", product_id)], limit=1)
|
||||||
)
|
)
|
||||||
vals["product_packaging_id"] = packaging.id
|
vals["product_packaging_id"] = packaging.id
|
||||||
return super().create(vals_list)
|
return super().create(vals_list)
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
:0.0.1: Initial module.
|
- 0.0.1: Initial module.
|
||||||
:1.0.0: rename to nfu_sale_order_batch_packaging
|
- 1.0.0: rename to nfu_sale_order_batch_packaging
|
||||||
:1.1.0: Live
|
- 1.1.0: Live
|
||||||
:1.2.0: Add regeneration action for batch products
|
- 1.2.0: Add regeneration action for batch products
|
||||||
:1.2.1: refactoring
|
- 1.2.1: refactoring
|
||||||
:1.3.0: add packaging states
|
- 1.3.0: add packaging states
|
||||||
:1.3.1: add open_max_qty
|
- 1.3.1: add open_max_qty
|
||||||
:1.3.2: fix color indicator
|
- 1.3.2: fix color indicator
|
||||||
:1.3.3: Enable packagings on installation
|
- 1.3.3: Enable packagings on installation
|
||||||
:1.3.4:
|
- 1.3.4:
|
||||||
- on creation set max_qty to product_uom_qty if not set
|
- on creation set max_qty to product_uom_qty if not set
|
||||||
- remove zero exception for max_qty
|
- remove zero exception for max_qty
|
||||||
- store open_packaging_qty on batch product module to make it sortable
|
- 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
|
- 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.4: store all quantities and round open values
|
||||||
|
- 1.3.5: make sure packages are readable by the user
|
||||||
|
|
@ -387,50 +387,30 @@ and adds a packaging default to sale order batch.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="changelog">
|
<div class="section" id="changelog">
|
||||||
<h1><a class="toc-backref" href="#toc-entry-1">Changelog</a></h1>
|
<h1><a class="toc-backref" href="#toc-entry-1">Changelog</a></h1>
|
||||||
<table class="docutils field-list" frame="void" rules="none">
|
<ul class="simple">
|
||||||
<col class="field-name" />
|
<li>0.0.1: Initial module.</li>
|
||||||
<col class="field-body" />
|
<li>1.0.0: rename to nfu_sale_order_batch_packaging</li>
|
||||||
<tbody valign="top">
|
<li>1.1.0: Live</li>
|
||||||
<tr class="field"><th class="field-name">0.0.1:</th><td class="field-body"><p class="first">Initial module.</p>
|
<li>1.2.0: Add regeneration action for batch products</li>
|
||||||
</td>
|
<li>1.2.1: refactoring</li>
|
||||||
</tr>
|
<li>1.3.0: add packaging states</li>
|
||||||
<tr class="field"><th class="field-name">1.0.0:</th><td class="field-body"><p class="first">rename to nfu_sale_order_batch_packaging</p>
|
<li>1.3.1: add open_max_qty</li>
|
||||||
</td>
|
<li>1.3.2: fix color indicator</li>
|
||||||
</tr>
|
<li>1.3.3: Enable packagings on installation</li>
|
||||||
<tr class="field"><th class="field-name">1.1.0:</th><td class="field-body"><p class="first">Live</p>
|
<li><dl class="first docutils">
|
||||||
</td>
|
<dt>1.3.4:</dt>
|
||||||
</tr>
|
<dd><ul class="first last">
|
||||||
<tr class="field"><th class="field-name">1.2.0:</th><td class="field-body"><p class="first">Add regeneration action for batch products</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="field"><th class="field-name">1.2.1:</th><td class="field-body"><p class="first">refactoring</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="field"><th class="field-name">1.3.0:</th><td class="field-body"><p class="first">add packaging states</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="field"><th class="field-name">1.3.1:</th><td class="field-body"><p class="first">add open_max_qty</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="field"><th class="field-name">1.3.2:</th><td class="field-body"><p class="first">fix color indicator</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="field"><th class="field-name">1.3.3:</th><td class="field-body"><p class="first">Enable packagings on installation</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="field"><th class="field-name">1.3.4:</th><td class="field-body"><ul class="first simple">
|
|
||||||
<li>on creation set max_qty to product_uom_qty if not set</li>
|
<li>on creation set max_qty to product_uom_qty if not set</li>
|
||||||
<li>remove zero exception for max_qty</li>
|
<li>remove zero exception for max_qty</li>
|
||||||
<li>store open_packaging_qty on batch product module to make it sortable</li>
|
<li>store open_packaging_qty on batch product module to make it sortable</li>
|
||||||
<li>always adjust max_qty to be at least uom_qty except you only set max qty</li>
|
<li>always adjust max_qty to be at least uom_qty except you only set max qty</li>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</dd>
|
||||||
</tr>
|
</dl>
|
||||||
<tr class="field"><th class="field-name">1.3.4:</th><td class="field-body"><p class="first last">store all quantities and round open values</p>
|
</li>
|
||||||
</td>
|
<li>1.3.4: store all quantities and round open values</li>
|
||||||
</tr>
|
<li>1.3.5: make sure packages are readable by the user</li>
|
||||||
</tbody>
|
</ul>
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="bug-tracker">
|
<div class="section" id="bug-tracker">
|
||||||
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
|
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue