<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Odoo/addons/stock/models/stock_picking.py, branch 14.0</title>
<subtitle>The current checkout of upstream Odoo</subtitle>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/'/>
<entry>
<title>[FIX] stock: fix check of package all in move lines</title>
<updated>2021-05-26T08:54:15+00:00</updated>
<author>
<name>Guewen Baconnier</name>
<email>guewen.baconnier@camptocamp.com</email>
</author>
<published>2020-12-17T13:03:37+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=d53d8bdf789e8f79ea4d531d944686abb59d6a26'/>
<id>d53d8bdf789e8f79ea4d531d944686abb59d6a26</id>
<content type='text'>
The `groupby` function is used to builds groups of(product, lot) keys
and their corresponding move lines / quants. `groupby` groups
*consecutive* keys, which is why the input is sorted by the keys.

`sorted` on recordsets keys will not sort as we would expect in this
particular situation, as the comparison operators on records act as
Set Comparison operators on the record ids, i.e. to compare the sets
superset/subset relationships:

```
&gt;&gt;&gt; env["product.product"].browse(1) &lt; env["product.product"].browse(2)
False
&gt;&gt;&gt; env["product.product"].browse(1) &lt; env["product.product"].browse([1, 2])
True
```

Example of sorted on stock.move.line records, where the product id 7313
is both in the slots 4 and 12 instead of being consecutive:

```
&gt;&gt;&gt; [l.product_id.id for l in sorted(lines, key=itemgetter('product_id'))]
[7436, 7437, 7352, 7423, 7313, 7351, 7423, 7424, 7320, 7398, 7312, 7352, 7313, 7436, 7437, 7442, 7443, 7320, 7423, 7424, 7318, 7396, 7368, 7355, 7316]
```

Now when we group by id the 2 ids 7313 are correctly placed together in
slots 1 and 2:

```
&gt;&gt;&gt; [l.product_id.id for l in sorted(lines, key=attrgetter('product_id.id'))]
[7312, 7313, 7313, 7316, 7318, 7320, 7320, 7351, 7352, 7352, 7355, 7368, 7396, 7398, 7423, 7423, 7423, 7424, 7424, 7436, 7436, 7437, 7437, 7442, 7443]
```

This commit aims to sort by "id" of the related records, to ensure the
same (product, lot) couples are consecutive.

closes odoo/odoo#71126

X-original-commit: 3317249dd88c97f96e8130d3d67a33a1075e0748
Signed-off-by: Arnold Moyaux &lt;amoyaux@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `groupby` function is used to builds groups of(product, lot) keys
and their corresponding move lines / quants. `groupby` groups
*consecutive* keys, which is why the input is sorted by the keys.

`sorted` on recordsets keys will not sort as we would expect in this
particular situation, as the comparison operators on records act as
Set Comparison operators on the record ids, i.e. to compare the sets
superset/subset relationships:

```
&gt;&gt;&gt; env["product.product"].browse(1) &lt; env["product.product"].browse(2)
False
&gt;&gt;&gt; env["product.product"].browse(1) &lt; env["product.product"].browse([1, 2])
True
```

Example of sorted on stock.move.line records, where the product id 7313
is both in the slots 4 and 12 instead of being consecutive:

```
&gt;&gt;&gt; [l.product_id.id for l in sorted(lines, key=itemgetter('product_id'))]
[7436, 7437, 7352, 7423, 7313, 7351, 7423, 7424, 7320, 7398, 7312, 7352, 7313, 7436, 7437, 7442, 7443, 7320, 7423, 7424, 7318, 7396, 7368, 7355, 7316]
```

Now when we group by id the 2 ids 7313 are correctly placed together in
slots 1 and 2:

```
&gt;&gt;&gt; [l.product_id.id for l in sorted(lines, key=attrgetter('product_id.id'))]
[7312, 7313, 7313, 7316, 7318, 7320, 7320, 7351, 7352, 7352, 7355, 7368, 7396, 7398, 7423, 7423, 7423, 7424, 7424, 7436, 7436, 7437, 7437, 7442, 7443]
```

This commit aims to sort by "id" of the related records, to ensure the
same (product, lot) couples are consecutive.

closes odoo/odoo#71126

X-original-commit: 3317249dd88c97f96e8130d3d67a33a1075e0748
Signed-off-by: Arnold Moyaux &lt;amoyaux@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock : wrong float_compare</title>
<updated>2021-04-30T10:15:02+00:00</updated>
<author>
<name>Florent de Labarre</name>
<email>florent.mirieu@gmail.com</email>
</author>
<published>2021-04-30T10:15:02+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=2e7dfec50e9104adf8efbc64e0342359dc8947a7'/>
<id>2e7dfec50e9104adf8efbc64e0342359dc8947a7</id>
<content type='text'>
add the name of argument, if not precision_digits is used.

closes odoo/odoo#70161

Signed-off-by: Arnold Moyaux &lt;amoyaux@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
add the name of argument, if not precision_digits is used.

closes odoo/odoo#70161

Signed-off-by: Arnold Moyaux &lt;amoyaux@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock: allow destination address change in transfer</title>
<updated>2021-03-05T14:32:33+00:00</updated>
<author>
<name>Andrea Grazioso (agr-odoo)</name>
<email>agr@odoo.com</email>
</author>
<published>2021-02-12T09:28:39+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=c813655074b3b83bdf9345ef12399b0b96feaf71'/>
<id>c813655074b3b83bdf9345ef12399b0b96feaf71</id>
<content type='text'>
- Create SO with deliverable product, confirm
- Change delivery Address on SO and on Transfer
- Inventory &gt; Stock moves (debug mode)
- Group by &gt; Picking and Destination address

The address shows is the original and not the updated one.

opw-2429018

closes odoo/odoo#66630

X-original-commit: b730d42e37275fd891fa0a3fd4a8ec1a4f95f3cf
Signed-off-by: agr-odoo &lt;agr-odoo@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- Create SO with deliverable product, confirm
- Change delivery Address on SO and on Transfer
- Inventory &gt; Stock moves (debug mode)
- Group by &gt; Picking and Destination address

The address shows is the original and not the updated one.

opw-2429018

closes odoo/odoo#66630

X-original-commit: b730d42e37275fd891fa0a3fd4a8ec1a4f95f3cf
Signed-off-by: agr-odoo &lt;agr-odoo@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock: Don't take into account canceled moves to check for backorder</title>
<updated>2021-02-23T09:54:32+00:00</updated>
<author>
<name>Denis Roussel</name>
<email>denis.roussel@acsone.eu</email>
</author>
<published>2021-02-13T11:33:47+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=79d834f2c2ec167831fe0986afb728207a467d67'/>
<id>79d834f2c2ec167831fe0986afb728207a467d67</id>
<content type='text'>
Do a transfer in two steps with several move lines (e.g.: Vendors =&gt; Input =&gt; Stock).

In the first picking, set quantity = 0 on a single line. Transfer it and say 'No backorder'.

In the second picking, set all quantities (you have two move lines confirmed and one canceled). Validate the
transfer. The backorder wizard is launched. It should not.

closes odoo/odoo#66272

X-original-commit: 25ae2416b08c6b3b1805b1f5de7df283d3a8ef0c
Signed-off-by: Arnold Moyaux &lt;amoyaux@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Do a transfer in two steps with several move lines (e.g.: Vendors =&gt; Input =&gt; Stock).

In the first picking, set quantity = 0 on a single line. Transfer it and say 'No backorder'.

In the second picking, set all quantities (you have two move lines confirmed and one canceled). Validate the
transfer. The backorder wizard is launched. It should not.

closes odoo/odoo#66272

X-original-commit: 25ae2416b08c6b3b1805b1f5de7df283d3a8ef0c
Signed-off-by: Arnold Moyaux &lt;amoyaux@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock: improve perf of `_compute_has_packages` of `stock.picking`</title>
<updated>2020-12-22T14:32:12+00:00</updated>
<author>
<name>Rémy Voet (ryv)</name>
<email>ryv@odoo.com</email>
</author>
<published>2020-12-04T16:52:22+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=a5df0a31e643ab126dd483f77c243892ca0fcb7d'/>
<id>a5df0a31e643ab126dd483f77c243892ca0fcb7d</id>
<content type='text'>
Use read_group instead of search count to batch the compute.

opw-2371161

closes odoo/odoo#63691

Signed-off-by: Arnold Moyaux &lt;amoyaux@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use read_group instead of search count to batch the compute.

opw-2371161

closes odoo/odoo#63691

Signed-off-by: Arnold Moyaux &lt;amoyaux@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock: improve perf of `_compute_has_packages` of `stock.picking`</title>
<updated>2020-11-30T13:19:57+00:00</updated>
<author>
<name>Rémy Voet (ryv)</name>
<email>ryv@odoo.com</email>
</author>
<published>2020-11-23T12:15:20+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=e78ca55997dfbf13c0798c1f59408450071e1452'/>
<id>e78ca55997dfbf13c0798c1f59408450071e1452</id>
<content type='text'>
When a picking contains a lot (&gt; 10000) of stock move line, the time
to open the picking become a issue (for 50000 sml, +- 6.5 sec) because of the
`_compute_has_packages`. Use a search with a limit=1 to avoid fetching
all `stock.move.line` with `result_package_id`
(for 50000 sml, +- 2.5 sec).

opw-2371161</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When a picking contains a lot (&gt; 10000) of stock move line, the time
to open the picking become a issue (for 50000 sml, +- 6.5 sec) because of the
`_compute_has_packages`. Use a search with a limit=1 to avoid fetching
all `stock.move.line` with `result_package_id`
(for 50000 sml, +- 2.5 sec).

opw-2371161</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock: move without package in immediate transfers</title>
<updated>2020-11-27T12:13:00+00:00</updated>
<author>
<name>William Henrotin</name>
<email>whe@odoo.com</email>
</author>
<published>2020-09-10T12:08:20+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=0d3f32988a862bbf13fcfbad37cce903ab4e9d60'/>
<id>0d3f32988a862bbf13fcfbad37cce903ab4e9d60</id>
<content type='text'>
Since 29d8fc091ab5, stock moves in immediate transfers are automatically
assigned. In case of configuration implying to show details action, new
moves disappear in stock picking

Task : 2329116</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since 29d8fc091ab5, stock moves in immediate transfers are automatically
assigned. In case of configuration implying to show details action, new
moves disappear in stock picking

Task : 2329116</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock: make `do_unreserve` faster than ever</title>
<updated>2020-11-18T10:32:09+00:00</updated>
<author>
<name>Rémy Voet (ryv)</name>
<email>ryv@odoo.com</email>
</author>
<published>2020-11-17T16:12:00+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=e7a43655448db161150d0c62efa14c54ade0a2f6'/>
<id>e7a43655448db161150d0c62efa14c54ade0a2f6</id>
<content type='text'>
`do_unreserve` is a action that can be made in the tree view of
`stock.picking` but it was very slow and not batched.
For 80 picking with -/+ 10 `stock.move.line` related each
(calculate on 5 sample of 80 pickings):
It took 17947 +- 2741 SQL requests, 7.37 +- 1.09 sec of SQL
and 8.13 +- 1.31 sec of python execution (+- 15.5 sec in total)

Make some  change to speed up the unreservation of
multiple picking/move:
- Batch the call of `_do_unreserve` of move in picking
- Use OrderedSet instead of RecordSet to reduce the complexity of
`_do_unreserve`. (Become significant when len(recordset) &gt; 1000)
- Add `.with_prefetch()` in the unlink of stock move line
to patch issue with prefetching + unlink + cache.
- Batch `_recompute_state`
- Also batch the `do_unreserve` of MO

Result after change in the same samples:
It take now 1438 +-	20 SQL requests, 0.45 +- 0.02 sec of SQL
and 0.68 +- 0.02 sec of python execution (+- 1.13 sec in total,
13 times faster). Note that the gain increase proportionally.

task-2383111

closes odoo/odoo#61879

Signed-off-by: Arnold Moyaux &lt;amoyaux@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`do_unreserve` is a action that can be made in the tree view of
`stock.picking` but it was very slow and not batched.
For 80 picking with -/+ 10 `stock.move.line` related each
(calculate on 5 sample of 80 pickings):
It took 17947 +- 2741 SQL requests, 7.37 +- 1.09 sec of SQL
and 8.13 +- 1.31 sec of python execution (+- 15.5 sec in total)

Make some  change to speed up the unreservation of
multiple picking/move:
- Batch the call of `_do_unreserve` of move in picking
- Use OrderedSet instead of RecordSet to reduce the complexity of
`_do_unreserve`. (Become significant when len(recordset) &gt; 1000)
- Add `.with_prefetch()` in the unlink of stock move line
to patch issue with prefetching + unlink + cache.
- Batch `_recompute_state`
- Also batch the `do_unreserve` of MO

Result after change in the same samples:
It take now 1438 +-	20 SQL requests, 0.45 +- 0.02 sec of SQL
and 0.68 +- 0.02 sec of python execution (+- 1.13 sec in total,
13 times faster). Note that the gain increase proportionally.

task-2383111

closes odoo/odoo#61879

Signed-off-by: Arnold Moyaux &lt;amoyaux@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock: Creating operation type as Administrator</title>
<updated>2020-11-18T16:44:43+00:00</updated>
<author>
<name>Goffin Simon</name>
<email>sig@odoo.com</email>
</author>
<published>2020-11-18T13:56:38+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=4265a131d6ee26c6dbe6f59ea98c18d9f6827844'/>
<id>4265a131d6ee26c6dbe6f59ea98c18d9f6827844</id>
<content type='text'>
Steps to reproduce the bug:

- Let's consider a user U with access rights Inventory Amdinistrator
- Try to create an operation type with U

Bug:

An access error was raised because U has no rights to create an ir.sequence
record.

opw:2381272

closes odoo/odoo#61964

X-original-commit: 472fc28255ad29bcaaa7bd2f68a64018361b2665
Signed-off-by: Simon Goffin (sig) &lt;sig@openerp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Steps to reproduce the bug:

- Let's consider a user U with access rights Inventory Amdinistrator
- Try to create an operation type with U

Bug:

An access error was raised because U has no rights to create an ir.sequence
record.

opw:2381272

closes odoo/odoo#61964

X-original-commit: 472fc28255ad29bcaaa7bd2f68a64018361b2665
Signed-off-by: Simon Goffin (sig) &lt;sig@openerp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock: create SM from SML</title>
<updated>2020-11-17T13:07:25+00:00</updated>
<author>
<name>Jinal Patel</name>
<email>jip@odoo.com</email>
</author>
<published>2019-05-20T06:15:04+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=f933c15794ec733be51d879de2410302d9804121'/>
<id>f933c15794ec733be51d879de2410302d9804121</id>
<content type='text'>
In this commit, creating SM from SML if trasfer is immediate. Due
to which following issues are getting resolve -
For immediate trasfer -

1) Unable to cancel the picking in draft state and SML is created
by view directly (No SM).

2) Unable to see button Put in pack.

3) Picking remains in state draft instead of ready.

task-2275833

closes odoo/odoo#57098

Signed-off-by: William Henrotin &lt;Whenrow@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In this commit, creating SM from SML if trasfer is immediate. Due
to which following issues are getting resolve -
For immediate trasfer -

1) Unable to cancel the picking in draft state and SML is created
by view directly (No SM).

2) Unable to see button Put in pack.

3) Picking remains in state draft instead of ready.

task-2275833

closes odoo/odoo#57098

Signed-off-by: William Henrotin &lt;Whenrow@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
