<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Odoo/addons/stock/tests/test_quant.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: couldn't unreserve mixed tracking stock</title>
<updated>2021-02-17T11:56:44+00:00</updated>
<author>
<name>Arnold Moyaux</name>
<email>arm@odoo.com</email>
</author>
<published>2021-01-26T11:13:22+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=572ba1be7d8b47192c98aec10cfe1b0b3dbbeb45'/>
<id>572ba1be7d8b47192c98aec10cfe1b0b3dbbeb45</id>
<content type='text'>
- Install stock
- Go to Inventory &gt; Configuration &gt; Settings and enable "Lots" and "Storage Locations"
- Create a Product tracked By Lots (i.e. Product X)
- Go to Inventory &gt; Operations &gt; Inventory Adjustments
- Create an Inventory Adjustment for Product X:

     Product   |   Location   |   Lot/SN   |   Real Quantity
 -------------------------------------------------------------
    Product X  |   WH/Stock   |   LOT 01   |       20
    Product X  |   WH/Stock   |            |       10

- Validate Inventory
- Go to Inventory &gt; Operations &gt; Transfers and create one:
  * Source Location: WH/Stock
  * Destination Location: WH/Stock/Shelf1
  * Operation Type: Internal Transfers
  * Operations:
    [Product: Product X, Initial Demand: 25]
- Save Transfer, Mark As Todo and Check availability
- Click on list icon of Operation line for Product X to display Detailed Operations
- 20 units of LOT 01 and 5 units without lot have been reserved
- Set LOT 01 for the 5 reserved units without lot and confirm
- Open Detailed Operations again
- There are now 20 units of LOT 01 and 5 units of LOT 01
- Remove the row with 5 units and confirm
- Check availability and open Detailed Operation
- There is now only a row with 25 reserved units of LOT 01
- Unreserve
The following errror is raised:
"It is not possible to unreserve more products of P than you have in stock."

It happens because the system is not able to manage quants with lots and
wihtout lots at the same time. When modifying the move line to 25
reserved units. It's composed of 20 quants with lot and 5 quants without
lot. And when unreserving it will check if there is a quants with 25
units with the lot and if it's not found 25 units without lot. But never
25 units of quants with lots and without lots.

opw-2419444

Close #64497

closes odoo/odoo#66347

X-original-commit: 3b59d0b12bc9a80e325aa07d004ed9cf9d85f857
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>
- Install stock
- Go to Inventory &gt; Configuration &gt; Settings and enable "Lots" and "Storage Locations"
- Create a Product tracked By Lots (i.e. Product X)
- Go to Inventory &gt; Operations &gt; Inventory Adjustments
- Create an Inventory Adjustment for Product X:

     Product   |   Location   |   Lot/SN   |   Real Quantity
 -------------------------------------------------------------
    Product X  |   WH/Stock   |   LOT 01   |       20
    Product X  |   WH/Stock   |            |       10

- Validate Inventory
- Go to Inventory &gt; Operations &gt; Transfers and create one:
  * Source Location: WH/Stock
  * Destination Location: WH/Stock/Shelf1
  * Operation Type: Internal Transfers
  * Operations:
    [Product: Product X, Initial Demand: 25]
- Save Transfer, Mark As Todo and Check availability
- Click on list icon of Operation line for Product X to display Detailed Operations
- 20 units of LOT 01 and 5 units without lot have been reserved
- Set LOT 01 for the 5 reserved units without lot and confirm
- Open Detailed Operations again
- There are now 20 units of LOT 01 and 5 units of LOT 01
- Remove the row with 5 units and confirm
- Check availability and open Detailed Operation
- There is now only a row with 25 reserved units of LOT 01
- Unreserve
The following errror is raised:
"It is not possible to unreserve more products of P than you have in stock."

It happens because the system is not able to manage quants with lots and
wihtout lots at the same time. When modifying the move line to 25
reserved units. It's composed of 20 quants with lot and 5 quants without
lot. And when unreserving it will check if there is a quants with 25
units with the lot and if it's not found 25 units without lot. But never
25 units of quants with lots and without lots.

opw-2419444

Close #64497

closes odoo/odoo#66347

X-original-commit: 3b59d0b12bc9a80e325aa07d004ed9cf9d85f857
Signed-off-by: Arnold Moyaux &lt;amoyaux@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[REF] various: use helper to create tests users</title>
<updated>2020-08-27T14:29:56+00:00</updated>
<author>
<name>Thibault Delavallée</name>
<email>tde@odoo.com</email>
</author>
<published>2020-08-26T07:57:36+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=910559c092dc7dfa00b91339a5423e16cd4668e1'/>
<id>910559c092dc7dfa00b91339a5423e16cd4668e1</id>
<content type='text'>
PURPOSE

Lessen use of mail-specific calls and variables

SPECIFICATIONS

Use mail_new_test_user tool in tests, lessening use of mail-specific context
keys in tests.

LINKS

Task ID-2326281 (context keys use cleaning)
PR odoo/odoo#56631
PR odoo/enterprise#12707</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
PURPOSE

Lessen use of mail-specific calls and variables

SPECIFICATIONS

Use mail_new_test_user tool in tests, lessening use of mail-specific context
keys in tests.

LINKS

Task ID-2326281 (context keys use cleaning)
PR odoo/odoo#56631
PR odoo/enterprise#12707</pre>
</div>
</content>
</entry>
<entry>
<title>[REF] stock: multi company</title>
<updated>2019-09-03T15:05:03+00:00</updated>
<author>
<name>Simon Lejeune</name>
<email>sle@openerp.com</email>
</author>
<published>2019-08-22T09:29:08+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=b6f053b25ef80599086797a41521c9e5679a015e'/>
<id>b6f053b25ef80599086797a41521c9e5679a015e</id>
<content type='text'>
Ensure proper domains are applied and enforced on relation fields thanks
to the `check_company` attributes.

product.template
- make responsible a property field in order to ensure proper next activities when a product
  is used between multiple companies
stock.putaway.rule
- added a company_id field
stock.move.line
- company_id is not related anymore since a move line can exist without a move until its validation
stock.package_level
- added a company_id field
stock.picking.type
- company_id is now required
stock.production.lot
- added a company_id field, adapted the constraint accordingly
stock.quant
- check the consistency only in inventory mode
stock.quant.package
- company_id is now empty if the package is empty
stock.picking
- company_id is now related to the one of its picking type

Added some tests.
Moved stock_traceability in the `report` directory.
Removed useless /tests/tours/route.js.

task-1985992</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Ensure proper domains are applied and enforced on relation fields thanks
to the `check_company` attributes.

product.template
- make responsible a property field in order to ensure proper next activities when a product
  is used between multiple companies
stock.putaway.rule
- added a company_id field
stock.move.line
- company_id is not related anymore since a move line can exist without a move until its validation
stock.package_level
- added a company_id field
stock.picking.type
- company_id is now required
stock.production.lot
- added a company_id field, adapted the constraint accordingly
stock.quant
- check the consistency only in inventory mode
stock.quant.package
- company_id is now empty if the package is empty
stock.picking
- company_id is now related to the one of its picking type

Added some tests.
Moved stock_traceability in the `report` directory.
Removed useless /tests/tours/route.js.

task-1985992</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] models: ORM speedup</title>
<updated>2019-08-20T12:43:59+00:00</updated>
<author>
<name>Raphael Collet</name>
<email>rco@odoo.com</email>
</author>
<published>2019-08-14T07:35:49+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=9920f20e4c7753bc17bea71dea3a90f7de687196'/>
<id>9920f20e4c7753bc17bea71dea3a90f7de687196</id>
<content type='text'>
This branch is the combination of several optimizations in the ORM:

* store field values once in the cache: the cache reflects more
faithfully the database, only fields that explicitly depend on the
context have an extra indirection in the cache;

* delay recomputations by default: use method `recompute` to explicitly
flush out pending recomputations;

* delay updates in method `write`: updates are stored in a data
structure that can be flushed efficiently to the database with method
`flush` (which also flush out recomputations);

* make method `modified` take advantage of inverse fields to inverse
dependencies;

* filter records by evaluating a domain on records in Python;

* a computed field with `readonly=False` behaves like a normal field
with an onchange method;

* computed fields are computed in superuser mode by default.

Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien
Pinckaers.

closes odoo/odoo#35659

Signed-off-by: Denis Ledoux &lt;beledouxdenis@users.noreply.github.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This branch is the combination of several optimizations in the ORM:

* store field values once in the cache: the cache reflects more
faithfully the database, only fields that explicitly depend on the
context have an extra indirection in the cache;

* delay recomputations by default: use method `recompute` to explicitly
flush out pending recomputations;

* delay updates in method `write`: updates are stored in a data
structure that can be flushed efficiently to the database with method
`flush` (which also flush out recomputations);

* make method `modified` take advantage of inverse fields to inverse
dependencies;

* filter records by evaluating a domain on records in Python;

* a computed field with `readonly=False` behaves like a normal field
with an onchange method;

* computed fields are computed in superuser mode by default.

Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien
Pinckaers.

closes odoo/odoo#35659

Signed-off-by: Denis Ledoux &lt;beledouxdenis@users.noreply.github.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] stock: pass tests without demo data for file test_quant.</title>
<updated>2019-07-11T13:12:09+00:00</updated>
<author>
<name>Hetashree Chauhan</name>
<email>hch@odoo.com</email>
</author>
<published>2019-06-20T05:54:22+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=9bf453acb8803373b193be994073d06819aa9476'/>
<id>9bf453acb8803373b193be994073d06819aa9476</id>
<content type='text'>
pass all test cases without any demo data.
If a user has not installed any demo data, then also test cases must not be break.

task-2024202
closes : https://github.com/odoo/odoo/pull/34258</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
pass all test cases without any demo data.
If a user has not installed any demo data, then also test cases must not be break.

task-2024202
closes : https://github.com/odoo/odoo/pull/34258</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] *: sudo() -&gt; with_user()</title>
<updated>2019-07-04T11:32:22+00:00</updated>
<author>
<name>Raphael Collet</name>
<email>rco@odoo.com</email>
</author>
<published>2019-06-17T09:45:09+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=b7fd679a6c41dbb694c6fb2ce4911798de0424b1'/>
<id>b7fd679a6c41dbb694c6fb2ce4911798de0424b1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[MERGE] forward port branch saas-12.3 up to 60e71302a38</title>
<updated>2019-05-13T13:26:12+00:00</updated>
<author>
<name>Christophe Simonis</name>
<email>chs@odoo.com</email>
</author>
<published>2019-05-13T13:26:12+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=8dd5a85267b522ba569ab9ed44901f95fffbeb4f'/>
<id>8dd5a85267b522ba569ab9ed44901f95fffbeb4f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[REF] stock: speedup tests</title>
<updated>2019-04-15T07:32:32+00:00</updated>
<author>
<name>Simon Lejeune</name>
<email>sle@openerp.com</email>
</author>
<published>2019-04-04T13:16:02+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=c5ff803fcce2daf44634228b1fe6afeeced3311a'/>
<id>c5ff803fcce2daf44634228b1fe6afeeced3311a</id>
<content type='text'>
before on runbot:
odoo.addons.stock.tests.test_move tested in 31.79s, 63166 queries
odoo.addons.stock.tests.test_move2 tested in 33.69s, 68046 queries
odoo.addons.stock.tests.test_quant tested in 8.48s, 15351 queries
odoo.addons.stock.tests.test_stock_flow tested in 16.99s, 31506 queries
amounting to 90 seconds on a build page

after om runbot:
odoo.addons.stock.tests.test_move tested in 12.41s, 24197 queries
odoo.addons.stock.tests.test_move2 tested in 13.55s, 24254 queries
odoo.addons.stock.tests.test_stock_flow tested in 9.74s, 15795 queries
amounting to 37 seconds on a build page

Use savepoint case instead of transaction case.

We took the opportunity to rename the master data more appropriately,
which results now in a bigger diff in TestMove and TestQuant. In
TestQuant, the master data creation had to be moved in the setUpClass
too.

We removed test_shipment as test_backorder_1-4 in tet_move_2 covers the
same parts of the code.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
before on runbot:
odoo.addons.stock.tests.test_move tested in 31.79s, 63166 queries
odoo.addons.stock.tests.test_move2 tested in 33.69s, 68046 queries
odoo.addons.stock.tests.test_quant tested in 8.48s, 15351 queries
odoo.addons.stock.tests.test_stock_flow tested in 16.99s, 31506 queries
amounting to 90 seconds on a build page

after om runbot:
odoo.addons.stock.tests.test_move tested in 12.41s, 24197 queries
odoo.addons.stock.tests.test_move2 tested in 13.55s, 24254 queries
odoo.addons.stock.tests.test_stock_flow tested in 9.74s, 15795 queries
amounting to 37 seconds on a build page

Use savepoint case instead of transaction case.

We took the opportunity to rename the master data more appropriately,
which results now in a bigger diff in TestMove and TestQuant. In
TestQuant, the master data creation had to be moved in the setUpClass
too.

We removed test_shipment as test_backorder_1-4 in tet_move_2 covers the
same parts of the code.</pre>
</div>
</content>
</entry>
<entry>
<title>[REF] stock: `_action_done` and cache invalidation</title>
<updated>2018-09-18T12:53:03+00:00</updated>
<author>
<name>Arnold Moyaux</name>
<email>arm@odoo.com</email>
</author>
<published>2018-03-23T10:38:15+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=c0d7a05730dca242ad60192b9905891e3afa9a90'/>
<id>c0d7a05730dca242ad60192b9905891e3afa9a90</id>
<content type='text'>
`_action_done` could unlink a quant. This happens when moving a product from a
location to another one and makes null the quantity of this product in one of
theses locations. In this case, we unlink the quant because it is now useless
and could be confusing on reports based on quants.

The unwanted side effect is that unlinking a record will invalidate the cache. In
some pathologic cases, like making an inventory adjustment of 600 products
and reseting their quantity back to 0, the time of the operation is around 15
minutes. With this patch that tries to work carefully with the cache invalidation,
the same operations takes around 15 secondes.

This commit do not unlink quant anymore, instead it use a 'garbage
collector' on quants without quantity. The garbage collector is trigger
on the scheduler and when the user open the inventory view.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`_action_done` could unlink a quant. This happens when moving a product from a
location to another one and makes null the quantity of this product in one of
theses locations. In this case, we unlink the quant because it is now useless
and could be confusing on reports based on quants.

The unwanted side effect is that unlinking a record will invalidate the cache. In
some pathologic cases, like making an inventory adjustment of 600 products
and reseting their quantity back to 0, the time of the operation is around 15
minutes. With this patch that tries to work carefully with the cache invalidation,
the same operations takes around 15 secondes.

This commit do not unlink quant anymore, instead it use a 'garbage
collector' on quants without quantity. The garbage collector is trigger
on the scheduler and when the user open the inventory view.
</pre>
</div>
</content>
</entry>
<entry>
<title>[REF] *: use native date/datetime for Date/Datetime fields</title>
<updated>2018-08-06T12:37:19+00:00</updated>
<author>
<name>Raphael Collet</name>
<email>rco@odoo.com</email>
</author>
<published>2018-08-06T12:37:19+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=960360afe478a8f7b9c456721b5591154952a37d'/>
<id>960360afe478a8f7b9c456721b5591154952a37d</id>
<content type='text'>
From this commit onwards, Date fields will return datetime.date objects and Datetime fields will return datetime.datetime objects, this implies a number of things that are clearly explained both in the ORM API for master.

This commit also introduces a number of helper functions for dates and datetimes that are exposed in tools.date_utils and fields.Date[time], explained in the documentation as well.

Task-ID: 47189</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
From this commit onwards, Date fields will return datetime.date objects and Datetime fields will return datetime.datetime objects, this implies a number of things that are clearly explained both in the ORM API for master.

This commit also introduces a number of helper functions for dates and datetimes that are exposed in tools.date_utils and fields.Date[time], explained in the documentation as well.

Task-ID: 47189</pre>
</div>
</content>
</entry>
</feed>
