[FIX] stock: don't require lot_id on reporting/location

To Reproduce
=============
- enable multi step routes
- edit Receipts operation and uncheck the two options under Traceability
- create storable product with Traceability using lot/serial number
- make purchase of this product and receive it in your inventory
- under inventory/reports/Locations click on line of this product
you will be stuck at that page even if you click discard

Problem
=======
There is an inconsistency between the view and backend, as we allow
receiving traceable product without setting `lot_id`, but in view
require `lot_id` if tracking is enabled on product.

Solution
========
following this [comment](https://github.com/odoo/odoo/blob/16.0/addons/stock/models/stock_move_line.py#L558-L560), `lot_id` shouldn't be required on view.

opw-3422259

closes odoo/odoo#130793

X-original-commit: 768b1755909fa10c39a51c68675b7aa99c91b462
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Abdelouahab Laaroussi (abla) <abla@odoo.com>
This commit is contained in:
Abdelouahab (abla)
2023-08-04 08:25:57 +02:00
parent ef47fd0d7d
commit 58a7f6cc61
+1 -2
View File
@@ -135,8 +135,7 @@
attrs="{'readonly': [('id', '!=', False)]}"/>
<field name="lot_id" groups="stock.group_production_lot"
attrs="{
'readonly': ['|', ('id', '!=', False), ('tracking', 'not in', ['serial', 'lot'])],
'required': [('tracking', '!=', 'none')]
'readonly': ['|', ('id', '!=', False), ('tracking', 'not in', ['serial', 'lot'])]
}"
invisible="context.get('hide_lot', False)"
context="{'default_product_id': product_id, 'default_company_id': company_id}"/>