<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Odoo/addons/stock/models/stock_move.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: reset stock move state</title>
<updated>2021-05-28T13:02:40+00:00</updated>
<author>
<name>Adrien Widart</name>
<email>awt@odoo.com</email>
</author>
<published>2021-05-11T09:16:35+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=05b6dfa0b1e4daf46d569c2e0a330b35e6437f8d'/>
<id>05b6dfa0b1e4daf46d569c2e0a330b35e6437f8d</id>
<content type='text'>
On a delivery, when changing the initial demand of a stock move, if its
value was 0 and becomes &gt; 0, its state will be 'Partially Available' but
the reserved quantity will still be 0.

To reproduce the error:
1. Create 2 products P01, P02
    - Product Type: Storable
    - Qty On Hand: 1
2. Create + Confirm a SO with 1xP01 and 1xP02
3. Open SO's delivery
4. Unlock, set P01's initial demand to 0, Save, Lock
5. Unreserve, Check Availability
6. Unlock, set P01's initial demand to 1, Save
7. Click on PO1 line

Error: The stock move state is "Partially Available", but the initial
demand is 1 and the reserved quantity is 0. It should be "Waiting
Availability"

On step 5, since the wanted quantity of P01 is 0, the state of the stock
move becomes "Available". Then, when increasing the requested quantity,
the state automatically becomes "Partially Available" because the module
does not consider the case where the state is "Available" with a
reserved quantity equal to 0.

OPW-2488580

closes odoo/odoo#71371

X-original-commit: 5773a1e0658d014e6d93a8728f324d76f51fbe25
Signed-off-by: Arnold Moyaux &lt;amoyaux@users.noreply.github.com&gt;
Signed-off-by: Adrien Widart &lt;adwid@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On a delivery, when changing the initial demand of a stock move, if its
value was 0 and becomes &gt; 0, its state will be 'Partially Available' but
the reserved quantity will still be 0.

To reproduce the error:
1. Create 2 products P01, P02
    - Product Type: Storable
    - Qty On Hand: 1
2. Create + Confirm a SO with 1xP01 and 1xP02
3. Open SO's delivery
4. Unlock, set P01's initial demand to 0, Save, Lock
5. Unreserve, Check Availability
6. Unlock, set P01's initial demand to 1, Save
7. Click on PO1 line

Error: The stock move state is "Partially Available", but the initial
demand is 1 and the reserved quantity is 0. It should be "Waiting
Availability"

On step 5, since the wanted quantity of P01 is 0, the state of the stock
move becomes "Available". Then, when increasing the requested quantity,
the state automatically becomes "Partially Available" because the module
does not consider the case where the state is "Available" with a
reserved quantity equal to 0.

OPW-2488580

closes odoo/odoo#71371

X-original-commit: 5773a1e0658d014e6d93a8728f324d76f51fbe25
Signed-off-by: Arnold Moyaux &lt;amoyaux@users.noreply.github.com&gt;
Signed-off-by: Adrien Widart &lt;adwid@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock: don't display assign SN for returns</title>
<updated>2021-03-23T13:58:02+00:00</updated>
<author>
<name>svs-odoo</name>
<email>svs@odoo.com</email>
</author>
<published>2021-03-02T15:55:58+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=e48c86dfecbec7d6f99499ce6b772b0df3c77798'/>
<id>e48c86dfecbec7d6f99499ce6b772b0df3c77798</id>
<content type='text'>
Before this commit, when delivered qty. for a product tracked by serial
numbers and then create a returns for this product, as the move is
linked to its original returned move, when the detailed operations will
be displayed, it will hide `lot_name` field and display the `lot_id`.
The issue is it will still show the "Assign Serial Numbers" feature.
As this feature is for the creation of new SN only (not for assign
existing ones), it should be hidden in this case because it will lead to
attempt to create already existing.

How to reproduce:
  - Create a product tracked by serial numbers;
  - Add at least two qty. on hand for this product and create as many
    serial numbers, following by numbers (ex.: sn01, sn02, sn03, ...);
  - Make a delivery for at least two of this product and proceed it;
  - When it's done, make a return for this delivery;
  - Open the delivery's return and display the detailed operations, then
    use the "Assign Serial Numbers" to try to reassign the delivery SN.
  --&gt; First, we will not see the SN on the move line (as `lot_id` is
      visible but `lot_name` is invisible).
  --&gt; Second, you can't mark as done the return as it will try to create
      the SN but they already exist.

To fix the issue, we can simply hide this feature when we hide the
`lot_name` field.

task-2474919
opw-2455971

closes odoo/odoo#68245

X-original-commit: fab1f31f70376d5477e67d153e2fa3c0f6477397
Signed-off-by: William Henrotin &lt;Whenrow@users.noreply.github.com&gt;
Signed-off-by: Steve Van Essche &lt;svs-odoo@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before this commit, when delivered qty. for a product tracked by serial
numbers and then create a returns for this product, as the move is
linked to its original returned move, when the detailed operations will
be displayed, it will hide `lot_name` field and display the `lot_id`.
The issue is it will still show the "Assign Serial Numbers" feature.
As this feature is for the creation of new SN only (not for assign
existing ones), it should be hidden in this case because it will lead to
attempt to create already existing.

How to reproduce:
  - Create a product tracked by serial numbers;
  - Add at least two qty. on hand for this product and create as many
    serial numbers, following by numbers (ex.: sn01, sn02, sn03, ...);
  - Make a delivery for at least two of this product and proceed it;
  - When it's done, make a return for this delivery;
  - Open the delivery's return and display the detailed operations, then
    use the "Assign Serial Numbers" to try to reassign the delivery SN.
  --&gt; First, we will not see the SN on the move line (as `lot_id` is
      visible but `lot_name` is invisible).
  --&gt; Second, you can't mark as done the return as it will try to create
      the SN but they already exist.

To fix the issue, we can simply hide this feature when we hide the
`lot_name` field.

task-2474919
opw-2455971

closes odoo/odoo#68245

X-original-commit: fab1f31f70376d5477e67d153e2fa3c0f6477397
Signed-off-by: William Henrotin &lt;Whenrow@users.noreply.github.com&gt;
Signed-off-by: Steve Van Essche &lt;svs-odoo@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock: disable auto-trigger scheduler with ir.config_parameter</title>
<updated>2021-03-22T13:00:18+00:00</updated>
<author>
<name>Fanny He</name>
<email>fah@odoo.com</email>
</author>
<published>2021-03-22T13:00:18+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=7ec5bae11ad89514a33db35810f4763e7631125f'/>
<id>7ec5bae11ad89514a33db35810f4763e7631125f</id>
<content type='text'>
Currently we automatically check reordering rules when a product cannot be
completely reserved, which allows to have a replenishment document for the
product without needing to run scheduler. This is unwanted for some users.
In this commit, we allow to disable this by adding a parameter to
ir.config_parameter. To disable it, set a parameter with name
"stock.no_auto_scheduler".

opw 2458507

closes odoo/odoo#68203

Signed-off-by: Simon Goffin (sig) &lt;sig@openerp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently we automatically check reordering rules when a product cannot be
completely reserved, which allows to have a replenishment document for the
product without needing to run scheduler. This is unwanted for some users.
In this commit, we allow to disable this by adding a parameter to
ir.config_parameter. To disable it, set a parameter with name
"stock.no_auto_scheduler".

opw 2458507

closes odoo/odoo#68203

Signed-off-by: Simon Goffin (sig) &lt;sig@openerp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock: fix rounding issue on available quantity</title>
<updated>2021-02-22T14:21:09+00:00</updated>
<author>
<name>Andrea Grazioso (agr-odoo)</name>
<email>agr@odoo.com</email>
</author>
<published>2021-02-03T12:11:51+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=bb411a2f125a09713eb749b6884308a8c2f15f36'/>
<id>bb411a2f125a09713eb749b6884308a8c2f15f36</id>
<content type='text'>
- Have a storable product with 3140.0 quantity on hand
- Make a sale order for 3106.40, confirm and validate delivery
- Reserved quantity will be 3106.40
- Make another sale order for 33.60, confirm and go to delivery
- Reserved quantity will be 33.59 because of a rounding issue when
calculating the available quantity

opw-2449732

closes odoo/odoo#65453

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>
- Have a storable product with 3140.0 quantity on hand
- Make a sale order for 3106.40, confirm and validate delivery
- Reserved quantity will be 3106.40
- Make another sale order for 33.60, confirm and go to delivery
- Reserved quantity will be 33.59 because of a rounding issue when
calculating the available quantity

opw-2449732

closes odoo/odoo#65453

Signed-off-by: agr-odoo &lt;agr-odoo@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock: disable auto-reserve with ir.config_parameter</title>
<updated>2021-02-18T07:48:57+00:00</updated>
<author>
<name>yhu-odoo</name>
<email>yhu@odoo.com</email>
</author>
<published>2021-02-17T15:04:33+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=04424cddf1e28a52fd7df3ad954d2d484b52972e'/>
<id>04424cddf1e28a52fd7df3ad954d2d484b52972e</id>
<content type='text'>
Currently we always auto-reserve products for moves when other incoming
picking makes the product available. This is unwanted for some users.
In this commit, we allow to disable this by add a parameter to
ir.config_parameter. To disable it, set a parameter with name
"stock.picking_no_auto_reserve".

PR #66373

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>
Currently we always auto-reserve products for moves when other incoming
picking makes the product available. This is unwanted for some users.
In this commit, we allow to disable this by add a parameter to
ir.config_parameter. To disable it, set a parameter with name
"stock.picking_no_auto_reserve".

PR #66373

Signed-off-by: Arnold Moyaux &lt;amoyaux@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock: sort move without description</title>
<updated>2021-02-03T12:37:07+00:00</updated>
<author>
<name>nie</name>
<email>nie@odoo.com</email>
</author>
<published>2021-02-03T12:36:32+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=f8cecfcc95fb46b0ea1c265e18c49769cb785784'/>
<id>f8cecfcc95fb46b0ea1c265e18c49769cb785784</id>
<content type='text'>
Steps:
- Go to Inventory &gt; Configuration &gt; Warehouse Management / Operations
  Types
- Edit Delivery Orders:
  - Show Detailed Operations: Checked
- Go to Overview
- Create a new Delivery Order:
  - Detailed Operations tab:
    - Add a product (1)
  - Operations tab:
    - Add the same product (1) and make sure it has a description
- Save

Bug:
Traceback here:
https://github.com/odoo/odoo/blob/82b188a090aa34c258840343cbf594969489dd6b/addons/stock/models/stock_move.py#L807
TypeError: '&lt;' not supported between instances of 'str' and 'bool'

Explanation:
A detailed operation has no description. Calling the description returns
`False`. When trying to save the delivery order with both detailed
operations and "normal" operations, the system tries to sort them out.
You cannot sort between different types (here, `str` and `bool`).

opw:2447720

closes odoo/odoo#65452

Signed-off-by: backspac &lt;backspac@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Steps:
- Go to Inventory &gt; Configuration &gt; Warehouse Management / Operations
  Types
- Edit Delivery Orders:
  - Show Detailed Operations: Checked
- Go to Overview
- Create a new Delivery Order:
  - Detailed Operations tab:
    - Add a product (1)
  - Operations tab:
    - Add the same product (1) and make sure it has a description
- Save

Bug:
Traceback here:
https://github.com/odoo/odoo/blob/82b188a090aa34c258840343cbf594969489dd6b/addons/stock/models/stock_move.py#L807
TypeError: '&lt;' not supported between instances of 'str' and 'bool'

Explanation:
A detailed operation has no description. Calling the description returns
`False`. When trying to save the delivery order with both detailed
operations and "normal" operations, the system tries to sort them out.
You cannot sort between different types (here, `str` and `bool`).

opw:2447720

closes odoo/odoo#65452

Signed-off-by: backspac &lt;backspac@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] stock: improve scalability of `_action_assign`</title>
<updated>2021-01-21T13:44:58+00:00</updated>
<author>
<name>Rémy Voet (ryv)</name>
<email>ryv@odoo.com</email>
</author>
<published>2020-12-28T12:50:06+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=b7a72fc97e1c7ddbc0d936d8320e49b18bf3b11c'/>
<id>b7a72fc97e1c7ddbc0d936d8320e49b18bf3b11c</id>
<content type='text'>
Replace union of RecordSet by union of OrderedSet to reduce the
complexity and improve the scalability. It can be a bottleneck to
huge number of move to assign.

task-2390516</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replace union of RecordSet by union of OrderedSet to reduce the
complexity and improve the scalability. It can be a bottleneck to
huge number of move to assign.

task-2390516</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock: lots ids disapear after onchange.</title>
<updated>2021-01-20T09:04:37+00:00</updated>
<author>
<name>Arnold Moyaux</name>
<email>arm@odoo.com</email>
</author>
<published>2021-01-19T12:49:42+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=a3ab5c3a73243e6f4d5662ee27765439ba9b5363'/>
<id>a3ab5c3a73243e6f4d5662ee27765439ba9b5363</id>
<content type='text'>
Use case to reproduce:
- Go to MO form produce at least 2 units of a product with a component
tracked by serial number.
- Edit the producing quantity to 1.0
- Save
- Edit the producing quantity to 2.0

The move lines are removed.

It happens because the lot_ids field is empty and thus the setter remove
the existing stock.move.line. It's empty because the compute try to do
a match on existing id. However the stock.move in the onchange
could have a new virtual id.

fine tuning of commit 8dfee8cb2d60942641b73eaa6489b02aa378c5ac

closes odoo/odoo#64747

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 case to reproduce:
- Go to MO form produce at least 2 units of a product with a component
tracked by serial number.
- Edit the producing quantity to 1.0
- Save
- Edit the producing quantity to 2.0

The move lines are removed.

It happens because the lot_ids field is empty and thus the setter remove
the existing stock.move.line. It's empty because the compute try to do
a match on existing id. However the stock.move in the onchange
could have a new virtual id.

fine tuning of commit 8dfee8cb2d60942641b73eaa6489b02aa378c5ac

closes odoo/odoo#64747

Signed-off-by: Arnold Moyaux &lt;amoyaux@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock: prevent from deleting reserved lines</title>
<updated>2021-01-18T10:49:03+00:00</updated>
<author>
<name>Adrien Widart</name>
<email>awt@odoo.com</email>
</author>
<published>2021-01-14T07:52:59+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=8dfee8cb2d60942641b73eaa6489b02aa378c5ac'/>
<id>8dfee8cb2d60942641b73eaa6489b02aa378c5ac</id>
<content type='text'>
When using a tracked product in a MO, the lot/serial number reservation
disappears even if the product is still reserved.

To reproduce the error:
(Need mrp)
1. Create two products P and P_compo
	- Both are storable
	- P_compo is tracked by lots
2. Update P_compo's quantity
	- Set the on hand quantity of lot L to 5
3. Create a MO
	- Product: P
	- Quantity: 5
	- Add a line: (Product: P_compo, To Consume: 5)
4. Confirm
5. Check availability
	- The P_compo's reserved quantity has been updated to 5. If you
click on the line's details, you can see that 5 P_compo has been
reserved from lot L
6. Back to the MO, in edit mode, change the done quantity: 3/5
	- There are still 5 reserved P_compo
7. Click on the P_compo's line details

ERR: the line we saw on step 5 disappeared. The MO says that 5 P_compo
are reserved, but when checking which lot is reserved, the latter is
no more visible. Moreover, if you click on "Confirm" (so you leave the
"Detailed Operations" pop-up), the "Reserved" field of the line will be
reset.

The lot reservation should stay so the user can complete the "Done"
field.

OPW-2420347

closes odoo/odoo#63941

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>
When using a tracked product in a MO, the lot/serial number reservation
disappears even if the product is still reserved.

To reproduce the error:
(Need mrp)
1. Create two products P and P_compo
	- Both are storable
	- P_compo is tracked by lots
2. Update P_compo's quantity
	- Set the on hand quantity of lot L to 5
3. Create a MO
	- Product: P
	- Quantity: 5
	- Add a line: (Product: P_compo, To Consume: 5)
4. Confirm
5. Check availability
	- The P_compo's reserved quantity has been updated to 5. If you
click on the line's details, you can see that 5 P_compo has been
reserved from lot L
6. Back to the MO, in edit mode, change the done quantity: 3/5
	- There are still 5 reserved P_compo
7. Click on the P_compo's line details

ERR: the line we saw on step 5 disappeared. The MO says that 5 P_compo
are reserved, but when checking which lot is reserved, the latter is
no more visible. Moreover, if you click on "Confirm" (so you leave the
"Detailed Operations" pop-up), the "Reserved" field of the line will be
reset.

The lot reservation should stay so the user can complete the "Done"
field.

OPW-2420347

closes odoo/odoo#63941

Signed-off-by: Arnold Moyaux &lt;amoyaux@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] stock: fix performance of forecasted when lot of locations</title>
<updated>2020-12-11T14:25:45+00:00</updated>
<author>
<name>Rémy Voet (ryv)</name>
<email>ryv@odoo.com</email>
</author>
<published>2020-12-11T14:00:03+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=f8861e6a63fcd85295affdea4b525af753234b14'/>
<id>f8861e6a63fcd85295affdea4b525af753234b14</id>
<content type='text'>
In the DB with a warehouse with a lot of stock location.
The forecasted widget return a traceback due to a memory error due
to the `_get_domain_locations_new`
(`_get_report_lines`-&gt;`read(['qty_available'])`-&gt;`_compute_quantities`
-&gt;`_compute_quantities_dict`-&gt;`_get_domain_locations`)
how returns a extremely long domain (one expression
by location in the context) to compute child location.
But the locations (put in the context) contain already
children locations because of
`('id', 'child_of', warehouse.view_location_id.id)`.

TO SOLVE
Instead of adding location in the context
(for fix 1aa6a323e04232d24175593718637c6dac295eb9),
add the warehouse in the context before
calling the `_get_report_lines` in the `_compute_forecast_information`.

closes #61666

closes odoo/odoo#63217

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 the DB with a warehouse with a lot of stock location.
The forecasted widget return a traceback due to a memory error due
to the `_get_domain_locations_new`
(`_get_report_lines`-&gt;`read(['qty_available'])`-&gt;`_compute_quantities`
-&gt;`_compute_quantities_dict`-&gt;`_get_domain_locations`)
how returns a extremely long domain (one expression
by location in the context) to compute child location.
But the locations (put in the context) contain already
children locations because of
`('id', 'child_of', warehouse.view_location_id.id)`.

TO SOLVE
Instead of adding location in the context
(for fix 1aa6a323e04232d24175593718637c6dac295eb9),
add the warehouse in the context before
calling the `_get_report_lines` in the `_compute_forecast_information`.

closes #61666

closes odoo/odoo#63217

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