[FIX] stock: action should be a dict

Steps:
- Install Inventory
- Go to Inventory > Configuration > Settings
- Enable Warehouse > Storage Locations
- Go to Inventory > Internal Transfers
- Create a transfer with a product and add done quantity to the product
- Come back to the list
- Select the Ready transfers
- Click Actions > Validate

Bug:
Traceback here: https://github.com/odoo/odoo/blob/7e9d052beabe15d932e5d403f8ca2f4837c7d24f/addons/web/controllers/main.py#L328
AttributeError: 'bool' object has no attribute 'setdefault'

Explanation:
`button_validate()` can return `True`. https://github.com/odoo/odoo/blob/7e9d052beabe15d932e5d403f8ca2f4837c7d24f/addons/stock/models/stock_picking.py#L861-L931
Therefore, a `True` action can be propagated up to the traceback point.
Another solution could be to only accept dict actions when calling `clean_action()`

closes odoo/odoo#63016

X-original-commit: 85bf2a3c322436808dbc46f6e0f8a68bf40f1b6c
Signed-off-by: backspac <backspac@users.noreply.github.com>
This commit is contained in:
nie
2020-12-08 12:21:10 +00:00
parent b0d1cb23b3
commit 3f16e5f19d
+2 -1
View File
@@ -515,7 +515,8 @@
<field name="code">
if records:
res = records.button_validate()
action = res
if isinstance(res, dict):
action = res
</field>
</record>