Current behavior:
Filter "Owner is not set" on Package in inventory app was causing a traceback
Steps to reproduce:
- Go in inventory app
- Go in package
- Apply a filter "Owner is not set"
- You get a traceback
opw-2714726
closesodoo/odoo#82237
X-original-commit: e4b350907f01253a96ddc763d6fdbdd307874e23
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
Improvements of the Inventory Adjustements page, among which:
- Add a new 'Apply All' button (without the need to select a record)
- Show the date at which the last count was done
- Add warning icon next to duplicated SN
- Allows to change the lot_id when empty and no quantities are set
closesodoo/odoo#78361
Signed-off-by: Arnold Moyaux <arm@odoo.com>
This commit rename product_uom_qty into reserved_uom_qty and product_qty
into reserved_qty on stock move line to stop mistake them with the stock
move quantities fields.
Task: 2648449
Part-of: odoo/odoo#80434
Package won't have a company_id untill the move is validated.
Previously, the package_type_id on package has the check_company to be
true. This forbiden any package type with company_id to be used on a not
validated package. In this commit, we remove check_company to avoid
this.
Task-2614519
X-original-commit: 66cbccb15368713ef04d2ba0f9e8808b72557b41
Part-of: odoo/odoo#80519
- When locations are activated, fix not being able to add a quant for tracked products just after
creating one from the 'update quantity' window due to Inventory Adjustment location being auto-selected [since it is the last quant]
- Fix quant not properly making fields invisible after confirming from the stock track
confirmation window
closesodoo/odoo#79338
Pr: https://github.com/odoo/odoo/pull/78768
Task-id: 2674732
X-original-commit: ff26704e7afaa537530c0e092a88b73ee791775f
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: npi-odoo <npi@odoo.com>
Previous task: odoo/odoo#61287 improved warnings for when using a
duplicate SN, including an auto-update of the source location when
appropriate. Unfortunately the auto-update is too risky when registering
a subcontracting SN tracked components.
Instead, we no longer update the source location when in a
subcontracting situation and update the warning message to match the
expected flow to fix the issue.
closesodoo/odoo#79334
Task: 2669180
X-original-commit: a430c4d7d6e2a02ef9b3905b554a779fc1643bcf
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Tiffany Chang <tic@odoo.com>
- Improve _search methods of stock/product by using subqueries
- Improve efficiency _search_on_hand of stock.quant (see
odoo/odoo#77190)
closesodoo/odoo#78847
X-original-commit: 82562cc25c10500d30056ca19d816c1d211a24eb
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Rémy Voet <ryv@odoo.com>
Sets the `inventory_quantity_set` as an editable field (not readonly)
and creates its own compute to avoid to override it each time the
`inventory_quantity` is modify and we set the `inventory_quantity_set`
aside (before this commit, this field new value was always overrided by
the `inventory_diff_quantity` compute).
This is useful when we want to write on the quants from the Barcode App
as we can write on `inventory_quantity` and `inventory_quantity_set` at
the same time.
task-2632818
closesodoo/odoo#78719
X-original-commit: 489e76ade600f7983a9a1976c04529ac542fdd44
Related: odoo/enterprise#21810
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
Signed-off-by: Steve Van Essche <svs-odoo@users.noreply.github.com>
Merge duplicate code of `_check_move_lines_map_quant_package` (of
`stock.picking` and `stock.package.level`.
Also remove unused `_get_contained_quants` method in
`stock.quant.package`
task-2648449
closesodoo/odoo#76761
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
This commit merge the wizards asking for a inventory name and the one
warning the user not all quant have been set.
Task : 2555118
Part-of: odoo/odoo#74715
As the inventory adjustments have been removed in favour of the editable
quants, this commit introduced the possibility to import pre counted
quants like non validated inventories back then.
task : 2555118
Part-of: odoo/odoo#74715
Assuming that the only thing cared about when removing items from stock
is the accessibility of the product. Then it would be better to take
products stored on the floor instead of on higher levels of my racks.
In this case current solutions in Odoo are not the most efficient.
Closest location picks items in the 'smallest' location (in alphabetical
order), so it assumes the locations are ordrered alphabetically
according to how close they are to the ground.
Assume we have the following stock :
- WH/Stock/Shelf 2
- WH/Stock
- WH/Stock/Shelf 1
Quants would be looked at in the following order :
1. WH/Stock (due to shortest name for the same stock)
2. WH/Stock/Shelf 1 (due to alphabetical order)
3. WH/Stock/Shelf 2
Task-2568735
closesodoo/odoo#75303
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
1. Add product category in inventory report.
2. Default quantity when creating a transfer switched to 1 instead of 0.
3. Remove the reorganize lines step in purchase tour (there is only 1
line).
closesodoo/odoo#69483
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
General improvements of the new Inventory Adjustment mechanism, among which:
From the Inventory Adjustment page
- A new inventory_quantity_set Boolean field is used to hide the Counted Quantity when not set instead of showing 0.
- Possibile to set 0 as a Counted Quantity directly (not using the set button).
- Allows to provide a name for the Inventory Adjustment when using the Apply button at the top of the tree view. This name is applied on the corresponding stock moves.
- Add warnings when trying to Apply/Set on multiple records when some records are not set/already set.
- Highlight lines when there is a mismatch between Quantity / Counted Quantity / Difference. If the user still tries to Apply, shows the option to either keep the current Difference or the current Counted Quantity for all records.
- Set the user when directly inserting a Counted Quantity (before only when using the Set button)
- Add the possibility to import records.
- Add "To Apply" filter.
- Add a 'Reset' button at the top of the tree view for multiple records.
From the Update Quantity page of a product
- Remove the "Updated on Hand Quantity" and can directly change "On Hand" quantity
- Pre-fill a default location (Last used location for tracked products or default destination location in single WH environment)
From the Inventory Report
- Remove the "Updated on Hand Quantity" and can directly change "On Hand" quantity
closesodoo/odoo#71199
Task-id: 2495664
Pr-community: 71199
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Before this commit, when quants where automatically unlinked, all empty
quants were took.
Now, quants with a defined `user_id` will not be unlinked because they
can legitimately be to 0 and we should wait inventory was processed
before empty quants were unlinked (as once the inventory is processed,
the `user_id` on quant is removed).
closesodoo/odoo#70275
X-original-commit: 7c5143e95ef1fcceafe5e331c3e8649e08666ae7
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: Steve Van Essche <svs-odoo@users.noreply.github.com>
Fix the access for stock user to stock.quant.
Since the inventory adjustement feature has been moved on
the stock.quant. The user should be able to write on them to
make their count. However we kept that a stock user can't validate
an inventory nor modify quantities on product
closesodoo/odoo#69006
X-original-commit: 6b8d40ec494dfbcaaef0da438692c76d0088f671
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
This commit removes stock.inventory(.line) and moves its general
functionality into stock.quant. Some features are lost during this
switch as well.
Feature Additions:
- New single list view for inventory adjustments (no more multiple
inventory adjustment records to keep track of!)
- Improved cyclic counts (annual inventory day setting) + next inventory
dates are immediately viewable in view (vs auto-generated inventories
based only on location)
- Specific quants (i.e. counts) can be assigned to users for more
flexibility (vs only able to restrict by location + product
combinations)
- Counts can be requested (i.e. bulk assigned to user/for a specific
inventory date)
Feature Removals:
- Can no longer look at previous inventory adjustments linked to a
specific record. Each quant has a history button to show inventory
related moves. [relevant account moves are also now harder to see via
stock as well]
Other changes:
- Bulk of changes were for demo/test
- Some changes were done to ensure "Update Quantity"/"Inventory Report"
views still mainly function the same as before with the exception of a
new column added to support updating quant quantities in these views.
Task: 2440026
ENT PR: odoo/enterprise#17329
Upgrade PR: odoo/upgrade#2326closesodoo/odoo#68409
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Currently, delivery packaging and product packaging share the same
model product.packaging. In this commit, we make delivery packaging
a new model stock.package.type. The code is also moved to stock
instead of delivery for compatibility reasons.
Task 2341820
PR #63516
ENT PR odoo/enterprise#15363
UPG PR odoo/upgrade#2040
Add and improve onchange warnings when a duplicate SN is used in
following cases: inventory, picking (any type), manufacturing, scrap,
and "Update Quantity" (i.e. directly edit quants from product form).
Improvement includes:
- include location where the existing SN is
- auto-correct source location when appropriate (e.g. trying to scrap a
SN in the wrong location)
The goal of this is to prevent but not restrict duplicate SNs so users
can have some flexibility (especially if a dupe SN occurs because of an
error such as doing pick-pack-ship out of order.)
closesodoo/odoo#61287
Task: 1924758
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Related fields are by default readonly and they should be when it
is possible. A editable related field will write on the related
model and will cause extra unwanted write of data. These unwanted write
can cause performance issues in some case (see odoo/odoo#63865).
Then remove the `readonly=False` of some related fields
(where it is useless):
- In 'mrp.workorder' (mrp): `working_state` and `production_date`
should be readonly.
- In 'purchase.order' (purchase): `product_id` should be readonly.
- In 'purchase.order.line' (purchase): `state` should be readonly.
- In 'product.supplierinfo' (purchase_requisition):
`purchase_requisition_id` should be readonly.
- In 'purchase.requisition' (purchase_requisition):
`product_id` should be readonly.
- In 'product.template' (stock):
`route_from_categ_ids` should be readonly.
- In 'stock.move.line' (stock):
`is_initial_demand_editable` should be readonly.
- In 'stock.move' (stock):
`product_tmpl_id` should be readonly.
- In 'stock.production.lot' (stock):
`product_uom_id` should be readonly.
- In 'stock.quant' (stock):
`product_tmpl_id` should be readonly.
- In 'stock.rule' (stock):
`route_sequence` should be readonly.
- In 'stock.change.product.qty' (stock):
`product_variant_count` should be readonly.
- In 'stock.return.picking.line' (stock):
`uom_id` should be readonly and also because it
is forced by `_prepare_stock_return_picking_line_vals_from_move`,
it should be related to the product uom not the one on the move.
task-2424248
In the model `stock.quant.package`, the `_compute_complete_name`
and the `name_get` mimics the default one (`_rec_name = "name"`).
Then remove clean it.
task-2373638
About this commit 8e7c0e544a8d3d18c57634750ee7ea03052c84b1
We need to manually invalidate the cache (of the quant) if a error
(other than concurrent ones) is raise from the write. Because
we can't know what the `write` has already put in the cache (e.g.
`write_uid`), we need invalidate it.
opw-2371161
X-original-commit: 7d75745267dada371d421ec93d50fb10b0006457
For validate 5K stock move line with SN:
Without index: 200 sec of SQL execution
With index: 15 of SQL execution
opw-2374846
X-original-commit: 21d7afca292f4c213d1fcfb4a31e0b7157eb941c
Issue:
The `_update_available_quantity` will flush the all environment due to
the savepoint (at each call). When we working with the package,
it becomes bottleneck due to the `_compute_package_info`. Indeed,
it computes two compute store field (`location_id` and `company_id`) and
depends of multiple field of related quants `quants_ids.xxx`. It means
that each time we enter/exit in the savepoint to update quants, this
compute will be execute (because of flush + compute_store).
Solution:
Avoid flushing when enter in the savepoint of
`_update_available_quantity` (`flush=False`)
Performance gain:
To validate a Delivery with 1000 move lines with package (source and
dest):
- Without patch: +- 120 sec
- With patch: +- 17 sec
opw-2371161
closesodoo/odoo#62841
X-original-commit: b2d57323caf9f7fe47c4fe9ac26b0e955d9987b9
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Commit 49b965eb1ec6a7ec6c07fa643cc6ae35ee8b5d91 introduced
`product_tmpl_ids` into the context for displaying kit components but
did not use it in the domain due to a missing `s`.
This commit adds the missing `s` in the domain.
closesodoo/odoo#62870
X-original-commit: aa135eb966810311837f4d446962850bb5aec82d
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
The 'On Hand' button triggers action_open_quants on product model. It
do not explode the kit into its component
closesodoo/odoo#62390
X-original-commit: 49b965eb1ec6a7ec6c07fa643cc6ae35ee8b5d91
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
This commit makes it so the quantity of a SN in a location is now
restricted between -1 < quantity < 1 (previously it was only quantity <
1). This change provides stronger protection against a duplicated SN
(e.g. a quantity of -2 means that the SN was somehow moved from that
location twice). This restriction was also relaxed to not include
location.usage='inventory' because this could prevent the user from
fixing a duplicated SN (since they were prevented from creating a
quantity of 2+ in an Inventory Loss location).
closesodoo/odoo#59834
Task: 2336455
Related: odoo/upgrade#1839
Related: odoo/enterprise#14667
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Add a new feature to allow automated (as part of scheduler) generation
of inventory adjustments based on user set value for how often they should
be done for 'internal' and 'transit' locations.
- When is the inventory created?
When cyclic frequency is set to a non-zero value, the next date an
inventory should be automatically generated for a location is based on
whether or not a previous inventory for that location was completed.
If an inventory is overdue based on the previous inventory date, one
will be scheduled for tomorrow. If no previous inventory date exists,
schedule the next one based on today's date. A new inventory will be
created by the scheduler if there is not an existing in progress
inventory for the location (to avoid a conflict).
- What about descendant locations?
Descendent locations will not have an inventory created if their
ancestor is supposed to have a cyclic inventory done at the same time.
Note this includes when that ancestory already has an in progress
inventory and isn't having a new one created.
- What about cleaning out of date cyclic inventories?
This automation will also delete existing draft inventories that include
this location (created before the day the scheduler is run) or any of
its descendants (i.e. inventories with only that descendant location
selected to avoid deleting obviously manually created inventories).
Task: 2336455
Upgrade PR: odoo/upgrade#1839
What are the steps to reproduce your issue ?
1. Install 'stock'
2. Create 'ProductA' with 'Tracking By Lots'
3. Create some 'Lots/Serial Numbers', for example 'CodeA0 and 'CodeA1'
4. Go to 'Reporting/Inventory Report'
5. Remove 'Product > Location' from the search bar.
6. Click 'Create' and select 'ProductA' with 'WH/Stock' Location
What is currently happening ?
When you set 'Lot/Serial Number', the available lots to choose
are not limited to the selected product only.
What are you expecting to happen ?
Show only lots of the selected product.
Why is this happening ?
The domain contained no condition which depended on the product.
How to fix the bug ?
Addition of a condition that depends on the product.
opw-238143
closesodoo/odoo#62046
X-original-commit: 3b33f1d3f5cb5182d5577176640bcf7427757ed2
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Previously, the field `package_use` was in `stock_barcode_picking_batch`
as this field is only used by the picking batchs in barcode.
But to avoid some overrides and so make the code simplier, it is now
declared in `stock`.
However, this field will not be visible in the package form view until
`stock_barcode_picking_batch` is installed.
closesodoo/odoo#59925
Related: odoo/upgrade#1855
Related: odoo/enterprise#14043
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
When using reusable package in chained transfers, indicates the package
should not be propagated for the next moves `result_package_id`.
This change has no effect by itself, but it's used in enterprise by
https://github.com/odoo/enterprise/pull/13146/commits/611b2c0b188ab9906eb21feab087a1794bd2d015 when Picking Batch is enabled
and barcode app is installed.
task-2333834
X-original-commit: 6677f501d5a1717af8da08a7e235d87aeb85f862
In inventory report, when groupby setted and no data, the create button
will open a new form instead of create a new line. Since now our form
view is not editable, no record can be created.
In this commit, add a new editable form view to solve it.
Task 2310494
PR #55910closesodoo/odoo#57344
X-original-commit: 4a4e60c65049082855414941642dadce8b413475
Related: odoo/enterprise#13067
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Use _for_xml_id to replace all the self.env.ref().read()[0]
This has the advantage of having a single point of control and to add
the fields filtering and model verification.
Add sudo for other operations on ir.actions.*
Replace wrong usages of any(list|recordset), by any(generator)
to speed up computations, avoiding list creations and/or looping twice on a recordset
for nothing.
any([generator]) => any(generator)
any(filtered) => any(generator)
closesodoo/odoo#55768
Related: odoo/enterprise#12360
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
At bee938e (following task-id 2042303), the label of the action was
changed globaly.
The action is however shared with multiple menus like Inventory Report.
The Update Quantity label only makes sense when coming from the
product where the quantity will be updated.
Closesodoo/odoo#50523
1. Create a new location of type internal in WH/Test
2. Create a new product P with availability of 100.0 in WH/Stock
3. Create a new transfer from WH/Stock to WH/Test with 50.0 units of P,
Put in Pack and Validate
4. Create a new transfer from WH/Test to WH/Stock/Shelf 1 using the
previous package, Validate and Unpack
5. Repeat steps from 3 and 4
6. Create a new transfer from WH/Stock/Shelf 1 to Customer with 100.0 units of P
7. Review stock quant from the location WH/Stock/Shelf 1
2 quants of the same product in the location WH/Stock/Shelf 1: one
negative with -50.0 and another positive with 50.0
The step 4 creates 2 quants of 50.0 units, which are reserved at step 6.
However, when validating the transfer 100.0 units are taken from one of
the quants.
To prevent this situation, we run the quant vacuum process after
unpacking. This will merge the 2 quants of 50.0 and prevent any future
negative quant creation. We also clean zero quants, although this is not
mandatory to fix our use case.
Closes#53535
opw-2283707
closesodoo/odoo#54431
X-original-commit: f7168311f4333f7fc684e00e1c1c284981718335
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Before this commit if you have a quant that has a location linked of the type 'view' you'd get this warning
but you would not know about which location this was and figuring that out is not trivial for most people.
After this commit users get notified about which location is of the type 'view' and can directly correct it if they want to.
closesodoo/odoo#51137
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>