odoo/odoo#188946
Created by fw-bot
Merged
at 7fa60ec6c4268b5914c375f78ef56291acbc2e21
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- label
- odoo-dev:master-16.0-sentry-6080156727-mrp-type-error-mega-4-4q-fw
- head
- 9d9c5636c147b765a5afa86dcc78fa55388aa49c
- merged
- 1 year ago by Bugfix, Meet Gandhi (mega)
odoo/odoo | |
---|---|
16.0 | #188434 |
17.0 | #188870 |
saas-17.2 | #188881 |
saas-17.4 | #188886 |
18.0 | #188889 |
saas-18.2 | |
saas-18.3 | |
saas-18.4 | |
19.0 | |
master | #188946 |
[FW][FIX] mrp: prevent an error when split a backorder of MO's
Currently, an error occurs when splitting a backorder of MO's.
Step to produce:
- Install the 'mrp' module.
- Enable work orders in the settings.
- Create a BOM for a product P with an operation: - OP1: Assembly line 1, duration 10 minutes.
- Create and confirm an MO for 5 units of P.
- Add a Work Center and Operation in the work order line.
- Set a producing quantity of 2.
- Validate the MO and create a backorder.
- Open a backorder of MO, Select a backorder that is in a confirmed state.
- Click on the 'Action' button to split a backorder into two productions.
See Traceback:
TypeError: argument of type 'NoneType' is not iterable
File "odoo/http.py", line 2363, in __call__
response = request._serve_db()
File "odoo/http.py", line 1891, in _serve_db
return self._transactioning(
File "odoo/http.py", line 1954, in _transactioning
return service_model.retrying(func, env=self.env)
File "odoo/service/model.py", line 137, in retrying
result = func()
File "odoo/http.py", line 1921, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "odoo/http.py", line 2168, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "odoo/addons/base/models/ir_http.py", line 329, in _dispatch
result = endpoint(**request.params)
File "odoo/http.py", line 727, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "addons/web/controllers/dataset.py", line 40, in call_button
action = call_kw(request.env[model], method, args, kwargs)
File "odoo/api.py", line 517, in call_kw
result = getattr(recs, name)(*args, **kwargs)
File "addons/mrp/wizard/mrp_batch_produce.py", line 59, in action_done
return self._production_text_to_object(mark_done=True)
File "addons/mrp/wizard/mrp_batch_produce.py", line 90, in _production_text_to_object
productions = self.production_id._split_productions({self.production_id: productions_amount})
File "home/odoo/src/enterprise/18.0/mrp_workorder/models/mrp_production.py", line 87, in _split_productions
productions = super()._split_productions(amounts=amounts, cancel_remaining_qty=cancel_remaining_qty, set_consumed_qty=set_consumed_qty)
File "addons/mrp/models/mrp_production.py", line 1996, in _split_productions
if workorder.production_id.id not in self.env.context.get('mo_ids_to_backorder', []):
An error occurs because the system retrieves a None value for 'mo_ids_to_backorder' from the context at [1], which is not iterable. This causes issues as an iterable value is expected.
Link [1]: https://github.com/odoo/odoo/blob/99e2b13416256a0a23a1a619b92873bcfe15b8a9/addons/mrp/models/mrp_production.py#L1846
To resolve this issue, provide an empty list
for 'mo_ids_to_backorder' if the retrieved value is None instead of an iterable.
Sentry-6080156727
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: #188434