Commit Graph
201 Commits
Author SHA1 Message Date
roen-odoo 7965efe75f [FIX] stock: Owner filter crash
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

closes odoo/odoo#82237

X-original-commit: e4b350907f01253a96ddc763d6fdbdd307874e23
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2022-01-05 10:42:41 +00:00
Nicolas Pierre bec3c58df3 [IMP] stock: Inventory Adjustments improvements
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

closes odoo/odoo#78361

Signed-off-by: Arnold Moyaux <arm@odoo.com>
2021-12-17 10:10:45 +00:00
Yannick TivisseandVictor Feyens 18952cdc76 [IMP] *: Convert single create method into multi
Taskid: 2703085
Part-of: odoo/odoo#80824
Co-authored-by: Victor Feyens <vfe@odoo.com>
2021-12-14 19:13:18 +00:00
William Henrotin 56e7bcf0cb [REF] *{stock,mrp}*: rename reserved fields
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
2021-12-07 16:20:06 +00:00
William Henrotin 6a23b9bcd6 [REF] *stock*: rename model stock.production.lot into stock.lot
Task: 2648449
Part-of: odoo/odoo#80434
2021-12-07 16:20:05 +00:00
yhu-odoo 251e9992c8 [FIX] stock: no check_company on package_type_id
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
2021-11-30 14:31:08 +00:00
Martin Trigaux a8e50921af [FIX] *: correct typos and English errors
closes odoo/odoo#80181

X-original-commit: efd178daee689192d4e930a075475587038b3e0d
Related: odoo/enterprise#22439
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-11-22 14:48:04 +00:00
Nicolas Pierre 1f00ffb0f2 [FIX] stock: inventory adjustments fixes
- 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

closes odoo/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>
2021-11-03 17:28:55 +00:00
Tiffany Chang (tic) dd1ea09f34 [FIX] mrp_subcontracting, stock: don't change loc when dupe SN
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.

closes odoo/odoo#79334

Task: 2669180
X-original-commit: a430c4d7d6e2a02ef9b3905b554a779fc1643bcf
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Tiffany Chang <tic@odoo.com>
2021-11-03 16:02:07 +00:00
Rémy Voet (ryv) 5bf41b77d6 [IMP] stock: use subquery in some _search methods
- Improve _search methods of stock/product by using subqueries
- Improve efficiency _search_on_hand of stock.quant (see
odoo/odoo#77190)

closes odoo/odoo#78847

X-original-commit: 82562cc25c10500d30056ca19d816c1d211a24eb
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Rémy Voet <ryv@odoo.com>
2021-10-25 07:31:48 +00:00
svs-odoo b60d53fe38 [IMP] stock: inventory_quantity_set own compute
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

closes odoo/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>
2021-10-21 07:32:54 +00:00
Rémy Voet (ryv) 6b942716a5 [REF] stock: clean _check_move_lines_map_quant
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

closes odoo/odoo#76761

Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-09-27 16:55:59 +00:00
William Henrotin f5a08bb1dc [FIX] stock: remove unused view
The quants are only displayed on list view

Task : 2555118

closes odoo/odoo#74715

Related: odoo/upgrade#2711
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-09-02 12:57:33 +00:00
William Henrotin 8f12dbc00f [IMP] stock: merge two wizards into one
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
2021-09-02 12:57:32 +00:00
William Henrotin 72f5b23063 [IMP] stock: change empty screen message
task : 2555118

Part-of: odoo/odoo#74715
2021-09-02 12:57:31 +00:00
William Henrotin 04beff906d [IMP] stock: allow importing quants
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
2021-09-02 12:57:31 +00:00
clesgow fe344c0ad6 [IMP] stock: removal in closest location
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

closes odoo/odoo#75303

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-08-30 10:58:52 +00:00
Ivan Yelizariev 9d34c72b2c [IMP] stock: clean up and speed up lock acquiring
It makes code more readable, doesn't use savepoing and use just a single query
to acquire the lock

closes odoo/odoo#72338

Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
2021-06-18 11:31:01 +00:00
Nicolas Pierre da1ec48481 [IMP] stock, purchase: usability improvements
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).

closes odoo/odoo#69483

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-06-07 10:38:31 +00:00
Nicolas Pierre 262b49d85a [IMP] stock: Inventory adjustments improvements
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

closes odoo/odoo#71199

Task-id: 2495664
Pr-community: 71199
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-05-31 13:15:54 +00:00
Swapnesh Shah 0454340853 [FIX] stock: use correct action name for inventory adjustments
User correct name for action on Inventory Adjustments view.

closes odoo/odoo#71007

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-05-18 18:25:09 +00:00
svs-odoo a419272f52 [FIX] stock: don't auto remove 0 quant with user
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).

closes odoo/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>
2021-05-03 15:39:15 +00:00
Arnold Moyaux 51d612fa3c [FIX] stock: inventory adjustement for user
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

closes odoo/odoo#69006

X-original-commit: 6b8d40ec494dfbcaaef0da438692c76d0088f671
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-04-08 17:52:44 +00:00
Arnold Moyaux bdcb3d192b [REF] stock: move stock.inventory feature into stock.quant
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#2326

closes odoo/odoo#68409

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-04-02 11:51:38 +00:00
yhu-odoo 1cd0a138cf [REF] delivery, stock: make delivery product a new model
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
2021-03-31 08:55:44 +00:00
Tiffany Chang (tic) 83a43af4cb [IMP] mrp,stock: improve duplicate SN warnings
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.)

closes odoo/odoo#61287

Task: 1924758
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-02-10 09:52:37 +00:00
nie 3962bb1c13 [FIX] board,stock: cannot add stock on hand report to dashboard
Steps:
- Install Inventory and Dashboard
- Go to Inventory > Reporting > Inventory Report
- Click Favorites
- Add to my Dashboard is missing
- Open the Favorites dropdown again
- Click Add to my Dashboard

Bug:
Error: Could not add filter to dashboard

Explanation:
This report action window is created dynamically by the server action
`action_view_quants`. The `id` isn't present, but it's not needed to
display the view. However, in order to create a dashboard item, the `id`
of an action is required as seen here:
https://github.com/odoo/odoo/blob/cfb5e6e82a773fee0342d5e0417bae4efeb7f0bb/addons/board/controllers/main.py#L16

This commit adds the ID of a new simple `ir.actions.act_window`. Reusing
`product_template_open_quants` is not possible because, when refreshing
the page, the view hasn't got any `active_ids`.

The menu item only appears after reopening the Favorites dropdown
because the frontend checks if the `id` of the action is present here:
https://github.com/odoo/odoo/blob/cfb5e6e82a773fee0342d5e0417bae4efeb7f0bb/addons/board/static/src/js/add_to_board_menu.js#L35-L40
but re-renders it every time the dropdown is closed, no matter what:
https://github.com/odoo/odoo/blob/cfb5e6e82a773fee0342d5e0417bae4efeb7f0bb/addons/board/static/src/js/add_to_board_menu.js#L50-L53

This commit also prevents the item from appearing after clicking
multiple times on the button.

opw:2426986

closes odoo/odoo#65383

X-original-commit: 9c9c4117ccc705dc47a67f659425de67e200542f
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: backspac <backspac@users.noreply.github.com>
2021-02-02 09:04:21 +00:00
Rémy Voet (ryv) 6df2aa1a41 [REF] stock: remove old from_string call in stock_quants.py
Remove useless calls `fields.Datetime.from_string` from
`_update_available_quantity`.

task-2424248

closes odoo/odoo#64357

Related: odoo/upgrade#2074
Related: odoo/enterprise#15685
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-01-21 11:09:58 +00:00
Rémy Voet (ryv) bec794f776 [REF] stock,purchase(_*),mrp: clean related fields
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
2021-01-21 11:09:58 +00:00
Rémy Voet (ryv) 03cc1e81a8 [REF] stock: remove useless name_get
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
2021-01-05 08:32:58 +00:00
Rémy Voet (ryv) c58865901f [FIX] stock: avoid flush all env in quants update
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
2020-12-23 16:08:01 +00:00
Rémy Voet (ryv) d5ea45c06e [FIX] stock: add index on lot_id of stock.quant
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
2020-12-23 16:08:01 +00:00
Rémy Voet (ryv) 93ed6754a5 [FIX] stock: fix in_date default
coming from aa7061e9bcbf10fa9dbeac4402d704a260644b66

closes odoo/odoo#63387

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-12-15 12:17:22 +00:00
Rémy Voet (ryv) e50dbe096d [REF] stock: _gather use now the ORM
Remove the feature of `NULL` order of stock.quant and put
the `in_date` required because it is always set (and should).

task-2413099

closes odoo/odoo#63165

Related: odoo/upgrade#2019
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-12-11 10:38:16 +00:00
Rémy Voet (ryv) e6cbfe6476 [FIX] stock: avoid flush all env in quants update
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

closes odoo/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>
2020-12-07 07:49:13 +00:00
William Henrotin d10c3fade4 [FIX] stock: fix typo in domain
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.

closes odoo/odoo#62870

X-original-commit: aa135eb966810311837f4d446962850bb5aec82d
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2020-12-04 10:21:58 +00:00
William Henrotin bebe4bd591 [FIX] mrp: open component quantity for kit
The 'On Hand' button triggers action_open_quants on product model. It
do not explode the kit into its component

closes odoo/odoo#62390

X-original-commit: 49b965eb1ec6a7ec6c07fa643cc6ae35ee8b5d91
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2020-11-26 11:33:00 +00:00
Tiffany Chang (tic) 274dd3bf50 [IMP] stock: improve SN quant restriction
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).

closes odoo/odoo#59834

Task: 2336455
Related: odoo/upgrade#1839
Related: odoo/enterprise#14667
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-11-24 10:42:28 +00:00
Tiffany Chang (tic) 3d2429f69a [IMP] stock: add cyclic inventory for locations
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
2020-11-24 09:38:37 +00:00
Achraf (abz) 336192256d [FIX] stock: Show only affected products for lot_id name_search
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

closes odoo/odoo#62046

X-original-commit: 3b33f1d3f5cb5182d5577176640bcf7427757ed2
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-11-19 18:03:11 +00:00
svs-odoo 396225e70f [REF] stock: move package_use in stock
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.

closes odoo/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>
2020-11-05 09:19:03 +00:00
svs-odoo d44b95fd45 [FIX] stock: empty reusable package
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
2020-11-05 09:19:03 +00:00
yhu-odoo f20dded993 [FIX] stock: inventory report form editable
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 #55910

closes odoo/odoo#57344

X-original-commit: 4a4e60c65049082855414941642dadce8b413475
Related: odoo/enterprise#13067
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-09-09 10:15:32 +00:00
Florent de Labarre 5e08aa3def [FIX] stock: impossible to merge quants with different in_date
When there are no conflict the same quant is used, even of in_date is different.
During _update_available_quantity https://github.com/odoo/odoo/blob/12.0/addons/stock/models/stock_quant.py#L209, Odoo use an existing quants without worring in_date (and use min()). Indeed During _gather in_date is not used to find quant (only used to use in ORDER BY) https://github.com/odoo/odoo/blob/12.0/addons/stock/models/stock_quant.py#L111.

It sould be logical to don't group by in_date during merge quants.

Have two quants with same product_id, location_id, company_id, lot_id, package_id, owner_id but with different in_date.
Try to merge quants
--> issue quants is not merge

closes odoo/odoo#57224

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-09-08 09:54:24 +00:00
Florent de Labarre 3d686814e2 [FIX] stock: cache is not clear after merge quants
closes odoo/odoo#57236

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-09-08 09:56:22 +00:00
Martin Trigaux 6156f98288 [FIX] *: adapt action content retrieval
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.*
2020-08-17 09:09:02 +00:00
Victor Feyens fdb23e282b [IMP] *: wrong any() usage
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)

closes odoo/odoo#55768

Related: odoo/enterprise#12360
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-08-14 09:56:10 +00:00
Martin Trigaux e61a3bc15a [IMP] stock: keep coherant action name
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.

Closes odoo/odoo#50523
2020-07-16 10:20:43 +00:00
Nicolas Martinelli e53218964a [FIX] stock: merge quants when unpacking
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

closes odoo/odoo#54431

X-original-commit: f7168311f4333f7fc684e00e1c1c284981718335
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-07-14 10:27:35 +00:00
Yenthe666 fdf381e1b6 [IMP] stock: show location name in warning
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.

closes odoo/odoo#51137

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-06-23 09:52:11 +00:00