Commit Graph
10973 Commits
Author SHA1 Message Date
Florent de LabarreandRaphael Collet 09985fd42a [FIX] stock: Exception are not correctly logged
Il during the scheduler an exception append, the error is not correctly logged.
This PR allow to catch the error with logger analyser (like sentry).

closes odoo/odoo#82648

X-original-commit: c68e1d1c13d116bda6b91fcbbcd61a26739a9894
Signed-off-by: Raphael Collet <rco@odoo.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
2022-01-12 15:49:20 +00:00
Adrien Widart 683c02b099 [FIX] repair,mrp,stock: count returned SN products
Suppose a tracked-by-usn and consumed product returns in the stock
thanks to a repair order. Using again this component in a new
manufacturing order will raise an error

To reproduce the issue:
1. In Settings, enable "Storage Locations"
2. Create two products P_finished, P_compo
    - Storable
    - P_comp tracked by USN
3. Update the quantity of P_compo:
    - WH/Stock: 1 x Lot01
4. Create a manufacturing order MO:
    - Product: P_finished
    - Components:
        - 1 x P_compo
5. Confirm, Check availability and Mark MO as Done
    - (Lot01 should be consumed)
6. Create a repair order RO:
    - Product: P_finished
    - Parts:
        - Type: Remove
        - Product: P_compo
        - Lot: Lot01
        - Destination Location: WH/Stock
7. Confirm RO, Start RO, End RO
    - (There should be one Lot01 available in stock)
8. Repeat 4-5

Error: When checking the availability on the MO, Lot01 is correctly
reserved. However, when marking the second MO as done, a User Error is
displayed: "The serial number Lot01 used for component P_compo has
already been consumed" although this lot should be available

When checking the uniqueness of the lot, nothing includes the products
back in stock thanks to the repair orders.

OPW-2701668

closes odoo/odoo#82544

X-original-commit: 3d9355f90fa1dd9436f1745c515c89947ed04de0
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2022-01-11 15:24:11 +00:00
Fabien Pinckaers 8ae4d92a58 [IMP] base: remove postprocessing of rendered pages
First step to stream QWeb templates: removing the two post
processing operations applied on rendered templates. This
should slightly speed up the rendering of every page.

1/ Don't remove empty lines after rendering, but fix the root
cause of: view inheritancies and QWeb compilation that don't
add extra empty lines.

2/ handle page break in the two reports that uses it, rather
than processing every view produced.

closes odoo/odoo#82244

Related: odoo/enterprise#23328
Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-01-10 19:28:29 +00:00
Arnold Moyaux fe0035b3e3 [IMP] stock: clean duplicated key
Two key are used for the same purpose. Remove one and
use its content directly in the report

clean commit bef1765b197a9e9d510a7d20d0364333402473b0

Part-of: odoo/odoo#82312
2022-01-07 20:42:44 +00:00
Hardik Prajapati 435730da10 [FIX] stock: traceability report traceback with productions
use case to reproduce:

    receipt a product tracked by lot
    produce a lot with a component tracked*
    open the traceability report for the lot's component

you have a traceback.

it's due to last_delivery_partner_id field present in the tree view of lots.
it triggers _compute_delivery_ids that call _find_delivery_ids_by_lot in multi.
the call in the recursion(trigger by *) redefine delivery_by_lot and erase the previous result.
so the cache is not correctly update and traceback

closes odoo/odoo#82351

X-original-commit: e6bcc77c58d39adbd782e776eb2f6d5c470eb0e2
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2022-01-06 19:30:57 +00:00
Habib (ayh) 1906dbfe4e [IMP] stock: include UOM object in aggregated product quantities
with l10n_mx_edi_stock being introduced in enterprise - we require the unit of measure object in the aggregated lines so that it can be used on the delivery report.

odoo/enterprise#21591
Task-2585661

closes odoo/odoo#82224

X-original-commit: 4d074686c1eb716020b950ea86650ecf2bda08aa
Related: odoo/enterprise#23244
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Ayob Habib (ayh) <ayh@odoo.com>
2022-01-06 07:42:54 +00:00
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
Touati Djamel (otd) 2a41d64b9b [FIX] stock: add address info in the delivery slip and picking operation report
Steps to reproduce the bug:
- Install inventory and sales
- Create a SO > Confirm
- Click on the delivery > print > delivery slip or picking operation

Problem:
Only the name and phone number are in the report

opw-2697221

closes odoo/odoo#82235

X-original-commit: 35e6abce0e662cae6a55293f31620114ad5ecd8a
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-01-04 17:53:19 +00:00
Arnold Moyaux 2d1f56381a [FIX] stock(_account): traceback with stock user on forecast report
2 issues:
- When going to the report forecast the value of the stock is computed.
However the stock user should not be able to access the valuations
- Since an access error is return the graph view is not instanciate and
the javascript code try to amend an empty result to the DOM. It results
with a traceback on top of 403 page

closes odoo/odoo#82074

X-original-commit: dbc6b1999ad478d0fdb5774624fd50ca4018be22
Related: odoo/enterprise#23185
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2022-01-03 10:52:45 +00:00
Florian Damhaut baa88e7a26 [FIX] stock: assign in priority to earlier move line
Steps to reproduce:
-Create a quote with 2 lines (same product - different lead time).
-When a partial delivery is made (e.g., 5 of 10), Odoo places the operation related to the remaining undelivered quantity (5), on the last line in the Operations list.
-When the next delivery is made, Odoo deducts the quantity from the first operation in the list instead of from the line whose deadline is closest.

Current Behaviour :
Odoo assign button assign quantity to the first move line in the list.

Behaviour After the PR:
Odoo assign button assign quantity to a move line based on the priority, the closest deadline and the id.

opw-2657048

closes odoo/odoo#82062

X-original-commit: 430f4f2ca1cebaea62415ee72bf4369684abbfaa
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Damhaut Florian (flda) <flda@odoo.com>
2021-12-30 15:15:26 +00:00
Arnold Moyaux 062ad4d998 [FIX] stock: add a partner on warehouse doesn't set correct properties
- Install stock with demo data
- Log in Chicago company
- Chicago partner has inter-company transit set on Customer and Supplier
locations
- Jeff Lawson (partner address of chicago warehouse) has Customer and
supplier locations set instead of inter-company transit.

It prevents the following usecase:
- Enable synch SO and PO between chicago and SF company with automatic
confirmation
- Create a product with route Buy and MTO
- Create a PO in company chicago that buy to SF comapny
- Validate the PO

You have an error with rule since it try to pull from intercompany
transit instead of customer

However if you log in San Francisco company Jeff Lawson has
inter-company transit set while it should not.

It happens because during the demo install the partner is added through
a write and the company is not provided and the code was missing a part
in that case.

closes odoo/odoo#82006

X-original-commit: 46c49ce4f6c9677463425981f01b69117c11943e
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2021-12-30 09:27:33 +00:00
Yannick Tivisse bbd65b8a3a [IMP] product,sale: Convert _onchange_type into compute methods 2021-12-23 15:30:23 +01:00
Yannick Tivisse 9e99a9df46 [IMP] product: Remove price/pricelist_id field from template/variant
Purpose
=======

The fields are not used, don't work correctly and there is a specific
report to generate the product prices according to the pricelist and
the ordered quantities
2021-12-23 15:30:23 +01:00
JF Aubert f11fcf6bb4 [REF] mrp: split productions
There is 2 major issues with the production of multiple serials number
- Performance issue
- Duplicated code with classic backorder mechanism

The performance issues exist since backorders were create one by one
and `stock.move` and `stock.move.line` are always recomputed. They
are not created in batch neither.

_generate_backorders is removed and replace by _split_productions. The
functionality are the same. Technicaly it does the maximum in batch,
first it creates all the `mrp.production` then all the `stock.move`
and finaly, it splits the existing `stock.move.line` among the new
`stock.move`
It means that the reservation is not recompute anymore during a
backorder process and will remain the same than the splitted production
order.

Performance metrics (10 components):

	|	2   |	10	100	 1000
before	|   0.47s   |  2.84s | 32.25s | 580.53s
-----------------------------------------------
after	|   0.13s   |  0.36s |  2.60s |  35.17s

task 2633369

Part-of: odoo/odoo#77254
2021-12-22 17:55:49 +00:00
Florian Damhaut 44300c6d74 [FIX] stock: print traceability report
Step to reproduce:
Try to print traceability report

Current Behaviour:
Traceback wrongly generated header

Behaviour after PR:
No Traceback, the header is now correctly generated

opw-2704299

closes odoo/odoo#81673

X-original-commit: 6b567326edc7bc691d87d911759ee30a24a8a1d7
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Damhaut Florian (flda) <flda@odoo.com>
2021-12-20 16:53:01 +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
Florian Damhaut e0c1071d59 [FIX] uom: Correct uom creation link
Since 6f182eeeab UoM should be created through the UoM category tab as the UoM form view is now unusable.
To ensure that this is the case, we remove menu link to the form view and update the other to lead to UoM category instead.

opw-2702953

closes odoo/odoo#81221

X-original-commit: 58a3954d606d48b2a4cf678eb0bf13d6e28b1aef
Signed-off-by: Damhaut Florian (flda) <flda@odoo.com>
2021-12-15 08:15:43 +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
Adrien Widart bf35fd86d0 [FIX] stock: correctly compare float
Due to floating point representation, some floats may have some
insignificant decimals. Therefore, `float_compare` should be used when
comparing such numbers

OPW-2699576

closes odoo/odoo#81138

X-original-commit: 7f30ef42717b009ee569db58b885ce863d969a06
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2021-12-09 13:47:49 +00:00
William Henrotin 9bb5c31a92 [IMP] stock,mrp: add indexes on picking type
This commit adds an index on picking_type_id for models stock.picking
and mrp.production.

Filtering on picking_type_id is often done via the Inventory Overview.
This should speed up the list render in case of many object.

Task : 2648449

closes odoo/odoo#80434

Related: odoo/upgrade#3068
Related: odoo/enterprise#22535
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2021-12-07 16:20:07 +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 cd9833e4ad [REF] *stock*: rename location destination fields
The stock convention on location name is always to name the destination
`location_dest_id`. It was not the
case on the stock rule model

Task: 2648449
Part-of: odoo/odoo#80434
2021-12-07 16:20:06 +00:00
William Henrotin c146c7d16f [REF] *stock*: rename model stock.location.route into stock.route
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
Martin Trigaux d99cfd9416 [I18N] *: export saas-15.1 source terms
closes odoo/odoo#80964

X-original-commit: 0663892a34896980008eb0de69aeb58019a67e89
Related: odoo/enterprise#22759
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-12-07 13:48:53 +00:00
yhu-odoo a9d9a258e4 [IMP] stock(_picking_batch): improve set/clear qty button
Add a "clear qty" button to revert the change by "set qty" button in
(batch) picking.
On the move, Whenever the qty_done != reserved, we consider it a
manual change from the user. "set/clear qty" buttons won't change the
line with manual change.
Show "set qty" button when there are moves with 0 qty_done and non-zero
reserved. Show "clear qty" button when we don't show "set qty" button
and there are moves with qty done == reserved but the number is not 0.

Task-2659233

closes odoo/odoo#78737

Signed-off-by: Steve Van Essche <svs@odoo.com>
2021-12-07 11:50:45 +00:00
Victor Feyens 31c3894b80 [REV] sale: do not precompute fields depending on x2m
and do not force precomputation on side models, it would reduce their performance.
2021-12-02 12:12:04 +01:00
Yannick Tivisse 232d66069a [IMP] sale: Make some field precomputed 2021-12-02 12:12:03 +01:00
Charles Ferir ccc85fd269 [FIX] stock: solve possible infinite recursion
Steps to reproduce:

  - Test upgrade request 40290

Issue:

  Traceback raised.

Cause:

  The _find_delivery_ids_by_lot function can raise a
  RecursionError: maximum recursion depth exceeded if
  there is a loop in the path of lots.

  When running the function recursively for
  lot_id contained in produce_line_ids the same lot
  can be reached multiple times.

  In the case of db 40290:
  move_380->move_381
  move_381 and move_419 both in lot_1320
  move_419->move_423
  move_423 and move_380 both in lot_567
  move_380->move_381
  ...(goes on forever)

Solution:

  Use a lot_path optionnal argument to test if
  a lot has already been visited.

Full Traceback:
```
Traceback (most recent call last):
  File "/tmp/tmp81rzi7n7/migrations/testing.py", line 208, in test_check
    self.check(value)
  File "/tmp/tmp81rzi7n7/migrations/base/tests/test_mock_crawl.py", line 85, in check
    self.assertFalse(diff, msg)
AssertionError: [('stock.menu_action_production_lot_form', 195, 'Inventory > Master Data > Lots/Serial Numbers', 310), ('mrp.menu_mrp_traceability', 258, 'Manufacturing > Products > Lots/Serial Numbers', 310)] is not false : At least one menu or view working before upgrade is not working after upgrade.

('stock.menu_action_production_lot_form', 195, 'Inventory > Master Data > Lots/Serial Numbers', 310):
 Traceback (most recent call last):
   File "/home/odoo/src/odoo/15.0/odoo/api.py", line 879, in get
    return field_cache[record._ids[0]]
 KeyError: 567

During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1057, in __get__
    value = env.cache.get(record, self)
   File "/home/odoo/src/odoo/15.0/odoo/api.py", line 882, in get
    raise CacheMiss(record, field)
 odoo.exceptions.CacheMiss: 'stock.production.lot(567,).delivery_count'

During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/tmp/tmp81rzi7n7/migrations/base/tests/test_mock_crawl.py", line 182, in crawl_menu
    self.mock_action(action_vals)
   File "/tmp/tmp81rzi7n7/migrations/base/tests/test_mock_crawl.py", line 293, in mock_action
    mock_method(model, view, fields_list, domain, group_by)
   File "/tmp/tmp81rzi7n7/migrations/base/tests/test_mock_crawl.py", line 319, in mock_view_form
    [data] = record.read(fields_list)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 3227, in read
    return self._read_format(fnames=fields, load=load)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 3247, in _read_format
    vals[name] = convert(record[name], record, use_name_get)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 5867, in __getitem__
    return self._fields[key].__get__(self, type(self))
   File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1106, in __get__
    self.compute_value(recs)
   File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1265, in compute_value
    records._compute_field_value(self)
   File "/home/odoo/src/odoo/15.0/addons/mail/models/mail_thread.py", line 410, in _compute_field_value
    return super()._compute_field_value(field)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 4249, in _compute_field_value
    getattr(self, field.compute)()
   File "/home/odoo/src/odoo/15.0/addons/stock/models/stock_production_lot.py", line 122, in _compute_delivery_ids
    delivery_ids_by_lot = self._find_delivery_ids_by_lot()
   File "/home/odoo/src/odoo/15.0/addons/stock/models/stock_production_lot.py", line 204, in _find_delivery_ids_by_lot
    for delivery_ids_set in line.produce_line_ids.lot_id._find_delivery_ids_by_lot().values():
   File "/home/odoo/src/odoo/15.0/addons/stock/models/stock_production_lot.py", line 204, in _find_delivery_ids_by_lot
    for delivery_ids_set in line.produce_line_ids.lot_id._find_delivery_ids_by_lot().values():
   File "/home/odoo/src/odoo/15.0/addons/stock/models/stock_production_lot.py", line 204, in _find_delivery_ids_by_lot
    for delivery_ids_set in line.produce_line_ids.lot_id._find_delivery_ids_by_lot().values():
   [Previous line repeated 926 more times]
   File "/home/odoo/src/odoo/15.0/addons/stock/models/stock_production_lot.py", line 197, in _find_delivery_ids_by_lot
    move_lines = self.env['stock.move.line'].search(domain)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 1810, in search
    res = self._search(args, offset=offset, limit=limit, order=order, count=count)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 4682, in _search
    query = self._where_calc(args)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 4438, in _where_calc
    return expression.expression(domain, self).query
   File "/home/odoo/src/odoo/15.0/odoo/osv/expression.py", line 442, in __init__
    self.parse()
   File "/home/odoo/src/odoo/15.0/odoo/osv/expression.py", line 701, in parse
    right_ids = comodel.with_context(active_test=False)._search([(path[1], operator, right)], order='id')
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 4683, in _search
    self._apply_ir_rules(query, 'read')
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 4464, in _apply_ir_rules
    expression.expression(domain, self.sudo(), self._table, query)
   File "/home/odoo/src/odoo/15.0/odoo/osv/expression.py", line 442, in __init__
    self.parse()
   File "/home/odoo/src/odoo/15.0/odoo/osv/expression.py", line 701, in parse
    right_ids = comodel.with_context(active_test=False)._search([(path[1], operator, right)], order='id')
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 4682, in _search
    query = self._where_calc(args)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 4438, in _where_calc
    return expression.expression(domain, self).query
   File "/home/odoo/src/odoo/15.0/odoo/osv/expression.py", line 431, in __init__
    self._unaccent = get_unaccent_wrapper(model._cr)
   File "/home/odoo/src/odoo/15.0/odoo/osv/expression.py", line 405, in get_unaccent_wrapper
    if odoo.registry(cr.dbname).has_unaccent:
   File "/home/odoo/src/odoo/15.0/odoo/__init__.py", line 104, in registry
    return modules.registry.Registry(database_name)
   File "/home/odoo/src/odoo/15.0/odoo/modules/registry.py", line 61, in __new__
    return cls.registries[db_name]
   File "/home/odoo/src/odoo/15.0/odoo/tools/func.py", line 71, in wrapper
    return func(self, *args, **kwargs)
 RecursionError: maximum recursion depth exceeded

('mrp.menu_mrp_traceability', 258, 'Manufacturing > Products > Lots/Serial Numbers', 310):
 Traceback (most recent call last):
   File "/home/odoo/src/odoo/15.0/odoo/api.py", line 879, in get
    return field_cache[record._ids[0]]
 KeyError: 567

During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1057, in __get__
    value = env.cache.get(record, self)
   File "/home/odoo/src/odoo/15.0/odoo/api.py", line 882, in get
    raise CacheMiss(record, field)
 odoo.exceptions.CacheMiss: 'stock.production.lot(567,).delivery_count'

During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/tmp/tmp81rzi7n7/migrations/base/tests/test_mock_crawl.py", line 182, in crawl_menu
    self.mock_action(action_vals)
   File "/tmp/tmp81rzi7n7/migrations/base/tests/test_mock_crawl.py", line 293, in mock_action
    mock_method(model, view, fields_list, domain, group_by)
   File "/tmp/tmp81rzi7n7/migrations/base/tests/test_mock_crawl.py", line 319, in mock_view_form
    [data] = record.read(fields_list)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 3227, in read
    return self._read_format(fnames=fields, load=load)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 3247, in _read_format
    vals[name] = convert(record[name], record, use_name_get)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 5867, in __getitem__
    return self._fields[key].__get__(self, type(self))
   File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1106, in __get__
    self.compute_value(recs)
   File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1265, in compute_value
    records._compute_field_value(self)
   File "/home/odoo/src/odoo/15.0/addons/mail/models/mail_thread.py", line 410, in _compute_field_value
    return super()._compute_field_value(field)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 4249, in _compute_field_value
    getattr(self, field.compute)()
   File "/home/odoo/src/odoo/15.0/addons/stock/models/stock_production_lot.py", line 122, in _compute_delivery_ids
    delivery_ids_by_lot = self._find_delivery_ids_by_lot()
   File "/home/odoo/src/odoo/15.0/addons/stock/models/stock_production_lot.py", line 204, in _find_delivery_ids_by_lot
    for delivery_ids_set in line.produce_line_ids.lot_id._find_delivery_ids_by_lot().values():
   File "/home/odoo/src/odoo/15.0/addons/stock/models/stock_production_lot.py", line 204, in _find_delivery_ids_by_lot
    for delivery_ids_set in line.produce_line_ids.lot_id._find_delivery_ids_by_lot().values():
   File "/home/odoo/src/odoo/15.0/addons/stock/models/stock_production_lot.py", line 204, in _find_delivery_ids_by_lot
    for delivery_ids_set in line.produce_line_ids.lot_id._find_delivery_ids_by_lot().values():
   [Previous line repeated 926 more times]
   File "/home/odoo/src/odoo/15.0/addons/stock/models/stock_production_lot.py", line 197, in _find_delivery_ids_by_lot
    move_lines = self.env['stock.move.line'].search(domain)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 1810, in search
    res = self._search(args, offset=offset, limit=limit, order=order, count=count)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 4682, in _search
    query = self._where_calc(args)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 4438, in _where_calc
    return expression.expression(domain, self).query
   File "/home/odoo/src/odoo/15.0/odoo/osv/expression.py", line 442, in __init__
    self.parse()
   File "/home/odoo/src/odoo/15.0/odoo/osv/expression.py", line 701, in parse
    right_ids = comodel.with_context(active_test=False)._search([(path[1], operator, right)], order='id')
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 4683, in _search
    self._apply_ir_rules(query, 'read')
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 4464, in _apply_ir_rules
    expression.expression(domain, self.sudo(), self._table, query)
   File "/home/odoo/src/odoo/15.0/odoo/osv/expression.py", line 442, in __init__
    self.parse()
   File "/home/odoo/src/odoo/15.0/odoo/osv/expression.py", line 701, in parse
    right_ids = comodel.with_context(active_test=False)._search([(path[1], operator, right)], order='id')
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 4682, in _search
    query = self._where_calc(args)
   File "/home/odoo/src/odoo/15.0/odoo/models.py", line 4438, in _where_calc
    return expression.expression(domain, self).query
   File "/home/odoo/src/odoo/15.0/odoo/osv/expression.py", line 431, in __init__
    self._unaccent = get_unaccent_wrapper(model._cr)
   File "/home/odoo/src/odoo/15.0/odoo/osv/expression.py", line 405, in get_unaccent_wrapper
    if odoo.registry(cr.dbname).has_unaccent:
   File "/home/odoo/src/odoo/15.0/odoo/__init__.py", line 104, in registry
    return modules.registry.Registry(database_name)
   File "/home/odoo/src/odoo/15.0/odoo/modules/registry.py", line 61, in __new__
    return cls.registries[db_name]
   File "/home/odoo/src/odoo/15.0/odoo/tools/func.py", line 71, in wrapper
    return func(self, *args, **kwargs)
 RecursionError: maximum recursion depth exceeded
```

closes odoo/odoo#80606

X-original-commit: acceb903b0487987edd5da9ce343c0f6c3ff44d8
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2021-11-30 16:07:47 +00:00
Arnold Moyaux 8861c45ff2 [FIX] stock: delivery slip missing address
commit af13e76629
reworked delivery split to add interwarehouse addresses but also
removed the address in a usual case.

opw-2701998

closes odoo/odoo#80609

X-original-commit: 9b9c4a3433d2a052e70e434b11817b791f38e508
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2021-11-30 14:31:22 +00:00
yhu-odoo 31984c8cd9 [IMP] stock: clean onchange for putaway
Clean the code for onchange method with putaway rule applied, merge
them into one onchange method.

Task-2614519

closes odoo/odoo#80519

X-original-commit: 5f562895c4d2f9beac7e0458fcee493b0141f1af
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2021-11-30 14:31:09 +00:00
yhu-odoo 6ac7e776b8 [FIX] stock: ignore the quantity of the current sml when apply putaway
When applying putaway rules, the qty of all existing assigned SM lines are
summed to calculate the incoming  qty of the product to determine if the
capacity has been or will be met. When a SM - that a putaway rule will apply
to - is created, then it will have its SM lines included in this calculation when
it shouldn't. In this case, we need to ignore the qty of those lines

Task-2614519

X-original-commit: 14738c7e5ecfba81e7ccbd401e1204d3bac960aa
Part-of: odoo/odoo#80519
2021-11-30 14:31:09 +00:00
yhu-odoo 14c494c3b3 [FIX] stock: calculate weight of package when apply putaway rule
Now when apply putaway rule on a package with package type, we calculate
the weight of the package according to the product in that package
instead of using the max weight of the package type.

Task-2614519

X-original-commit: 0281ebec36dbb9effd3d2913c0d38c88f9f19920
Part-of: odoo/odoo#80519
2021-11-30 14:31:09 +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
yhu-odoo 53852391d3 [FIX] stock: count incoming package number when apply putaway rule
Previously when apply putaway rule, we only count the packages in the
location to check if there is enough space the incoming package. Now we
also count all other assigned incoming packages to that location to
avoid overflow.

Task-2614519

X-original-commit: 21373dbc507e57c3a19b415583a5b0595a66c1a3
Part-of: odoo/odoo#80519
2021-11-30 14:31:07 +00:00
yhu-odoo 87fd6b7692 [FIX] stock: Add missing packaging when find a putaway location
When apply a putaway rule to find a putaway location, we only pass the
product and/or package info to _get_putaway_location. This is not
enough since the putaway rule can also be applied to packaging.

X-original-commit: 9f339938aec075c5385dca349dfc6a7c2d43b6ad
Part-of: odoo/odoo#80519
2021-11-30 14:31:07 +00:00
yhu-odoo 6206b0858b [FIX] stock: improve putaway when put in pack
Put in Pack won't trigger any onchange to use putaway rules. In this
commit, we apply putaway rule in Put in Pack when only one move line
is put in pack. We also check if the ml to put in pack are all in same
package type, if so, we set that package type on the package.

Task-2614519

X-original-commit: 023b69ac2ccac2456bcb1a8b1b66b468e213b86a
Part-of: odoo/odoo#80519
2021-11-30 14:31:07 +00:00
yhu-odoo b9b7bde33d [FIX] stock: add company_id to package type view
We didn't show company_id on package type view, there was no way to
change it. Add it in this commit.
Also made company_id on stock_storage_category form not visible when not
in multi-company.

X-original-commit: 61792e9dc13bf9d326e69eb59efe3a22354f1ca5
Part-of: odoo/odoo#80519
2021-11-30 14:31:06 +00:00
yhu-odoo 152cb2a9f2 [FIX] stock: missing package when create stock move line
When find putaway location while creating new sml, we didn't consider
the package. Add it back.

Task-2614519

X-original-commit: fcbd4c775248f18c71f9cb0e700ed9934babcdfd
Part-of: odoo/odoo#80519
2021-11-30 14:31:06 +00:00
yhu-odoo 22df4c807c [FIX] stock: find putaway location of correct dest_location
Previously when the onchange method find a putaway location for a sml, we
find a putaway location of the location_dest on the sml. However, the
location may already be a result of last computation of putaway
location. In this commit, we always find putaway location of the default
destination location.

Task-2614519

X-original-commit: a96fb8e9d2a57b67666ca3b29c9313aba83cdb91
Part-of: odoo/odoo#80519
2021-11-30 14:31:06 +00:00
Raman Salihi 45e0d3f0e6 [FIX] stock: fix grammar in reordering rule view
closes odoo/odoo#80406

Signed-off-by: Arnold Moyaux <arm@odoo.com>
2021-11-30 13:41:35 +00:00
Touati Djamel (otd) e2b965cd89 [FIX] stock, mrp: fix the manufacturing product moves filter
Steps to reproduce the bug:
- Create a storable product > add a BOM
- Create a MO> add the product > confirm > Mark as done
- Go to the product form > click on product moves
- The move linked to the MO is displayed
- Add the "Manufacturing" filter
- No move is displayed

Solution:
Display all "stock.move.line" which are linked to a "stock.move" with a "mrp.production"

Bug2:
The "Manufacturing" filter should be defined in the MRP module instead of the stock
otherwise, users who do not have MRP installed will have access to this filter as well

opw-2697254

closes odoo/odoo#80578

X-original-commit: f4ab29a19f0aaac567da27d4c4d5c79119982bc6
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2021-11-30 12:06:18 +00:00
Alfredo Zamora bcbd60dc77 [FIX] stock: stock.picking.state to draft associating existing picking to a computed field
X-original-commit: 86315761dc154e55dd464a6945eea4ac178fb602
Part-of: odoo/odoo#80539
2021-11-29 15:41:03 +00:00
Adrien Widart a8d350fe11 [FIX] stock: add required fields to SML's kanban view
When using a mobile, scanning a product to manage a delivery won't work

To reproduce the error:
(Need stock_barcode. Use demo data)
1. In Operations Types, edit "Delivery Orders":
    - Enable "Show Detailed Operations"
3. Create a planned delivery order DO:
    - 1 x [FURN_1118] Corner Desk Black
4. Mark a Todo
5. Switch to a mobile view
6. Edit DO and scan 601647855640 (i.e., the barcode of FURN_1118)
7. Save DO

Error: An error is displayed "The operation cannot be completed [...]
Model: Product Moves (Stock Move Line) (stock.move.line), Field: From
(location_id)"

The kanban view does not include both `location_id` and
`location_dest_id` although they are required

OPW-2688915

closes odoo/odoo#80470

X-original-commit: 248f659615a2934df7b5ee83734aa78508987fdb
Signed-off-by: Adrien Widart <awt@odoo.com>
2021-11-29 08:50:19 +00:00
Vishal Thacker 7622c48223 [IMP] stock: default product replenish quantity
The product replenish wizard quantity will be set to the selected
`product_id` forecast quantity if it's a negative value (otherwise, it
will be set to 1).

task-2581265

Part-of: odoo/odoo#74695
2021-11-26 15:10:26 +00:00
Vishal Thacker e71a9e4494 [IMP] stock: added groups to packaging field
Before this commit, packaging field was visible on the stock location
form view even if the packaging configuration set to off.

task-2581265

Part-of: odoo/odoo#74695
2021-11-26 15:10:26 +00:00
Vishal Thacker ccefd39015 [IMP] stock: add orderpoint Trigger Manual filter
Replaces the orderpoint's default search on manual trigger by a search
filter named "Trigger Manual".

task-2581265

Part-of: odoo/odoo#74695
2021-11-26 15:10:25 +00:00
Vishal Thacker a317d12d50 [IMP] stock: do not open reserve/unreserve action in new breadcrumb
Before this commit: when reserve/unreserve button were clicked, it was
opening action in new breadcrumb while it should not open new breadcrumb
instead it should display in self.

After this commit: reserve/unreserve button will open action and replace
current action and will not open new breadcrumb everytime we click.

task-2581265

Part-of: odoo/odoo#74695
2021-11-26 15:10:25 +00:00
Vishal Thacker ec75fe6c0f [IMP] stock: Changed the string of lot_name field
Part-of: odoo/odoo#74695
2021-11-26 15:10:25 +00:00
Vishal Thacker b43ac31f70 [IMP] sale,stock,website_sale: texts update
- Renames "DHL"/"DHL USA Connector" into "DHL Express Connector";
- Changes the orderpoint's constraint message when the user's trying to
create an orderpoint who already exists.

task-2581265

Part-of: odoo/odoo#74695
2021-11-26 15:10:24 +00:00