Skip to content

Commit

Permalink
[FIX] stock: always read field for default_order in move.line tree
Browse files Browse the repository at this point in the history
Previous PR odoo#143570 moved some move line ordering logic from the
model to the view to avoid recomputing of these fields since it was
causing issues with the computes occurring at the wrong time.
Unfortunately every field used in the `default_order` in the view has to
be present in the view and since v16 any fields that have a groups
attribute that isn't met isn't loaded in the view.

Therefore we have to force the `result_package_id` to always be in the
view even if `stock.group_tracking_lot` is not true (i.e. packages are
active)

Steps to reproduce:
- create +save a receipt with a tracked product
- click on the burger button to open the detailed operations of the
  tracked product
- add 2 move lines + Confirm

Expected behavior:
the move lines save

Actual behavior:
JS traceback due to trying to sort on a field that isn't present in the
view

closes odoo#147025

X-original-commit: 79f12ed
Signed-off-by: Quentin Wolfs (quwo) <[email protected]>
Signed-off-by: Tiffany Chang (tic) <[email protected]>
  • Loading branch information
ticodoo committed Dec 21, 2023
1 parent 836fa62 commit 8df5d82
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions addons/stock/views/stock_move_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
<field name="location_id" invisible="1"/>
<field name="location_dest_id" invisible="1"/>
<field name="package_id" invisible="1"/>
<field name="result_package_id" invisible="1"/>
<field name="quant_id"
domain="[('product_id', '=', product_id), ('location_id', 'child_of', parent.location_id)]"
context="{'default_location_id': location_id, 'default_product_id': product_id, 'search_view_ref': 'stock.quant_search_view', 'tree_view_ref': 'stock.view_stock_quant_tree', 'form_view_ref': 'stock.view_stock_quant_form', 'readonly_form': True}"
Expand Down

0 comments on commit 8df5d82

Please sign in to comment.