KeyError when assigning moves containing consumable products
In 6.8 series, when assigning a production that mixes consumable and non consumable products I get the following traceback: ``` 386341 140271948920512 [2023-05-25 12:26:20,826] ERROR trytond.protocols.wrappers <JSONRequest 1@127.0.0.1 'http://localhost:8000/xxxxx/' [POST] wizard.stock.shipment.assign.execute> Traceback (most recent call last): File "/home/pokoli/.virtualenvs/xxxxx/lib/python3.10/site-packages/trytond/protocols/wrappers.py", line 189, in wrapper return func(request, pool, *args, **kwargs) File "/home/pokoli/.virtualenvs/xxxxx/lib/python3.10/site-packages/trytond/protocols/dispatcher.py", line 204, in _dispatch result = rpc.result(meth(*c_args, **c_kwargs)) File "/home/pokoli/.virtualenvs/xxxxx/lib/python3.10/site-packages/trytond/wizard/wizard.py", line 340, in execute result = wizard._execute(state_name) File "/home/pokoli/.virtualenvs/xxxxx/lib/python3.10/site-packages/trytond/wizard/wizard.py", line 380, in _execute result = self._execute(transition()) File "/home/pokoli/.virtualenvs/xxxxx/lib/python3.10/site-packages/trytond/modules/stock/shipment.py", line 2971, in transition_start self.record.assign_try() File "/home/pokoli/.virtualenvs/xxxxx/lib/python3.10/site-packages/trytond/model/descriptors.py", line 31, in newfunc return self.func(owner, [instance], *args, **kwargs) File "/home/pokoli/.virtualenvs/xxxxx/lib/python3.10/site-packages/trytond/model/modelview.py", line 720, in wrapper return func(cls, records, *args, **kwargs) File "/home/pokoli/.virtualenvs/xxxxx/lib/python3.10/site-packages/trytond/modules/production/production.py", line 784, in assign_try if Move.assign_try(to_assign): File "/home/pokoli/.virtualenvs/xxxxx/lib/python3.10/site-packages/trytond/modules/stock/move.py", line 1119, in assign_try to_assign.extend(cls.copy( File "/home/pokoli/.virtualenvs/xxxxx/lib/python3.10/site-packages/trytond/modules/account_invoice_stock/stock.py", line 75, in copy return super().copy(moves, default=default) File "/home/pokoli/.virtualenvs/xxxxx/lib/python3.10/site-packages/trytond/model/workflow.py", line 62, in copy return super().copy(records, default=default) File "/home/pokoli/.virtualenvs/xxxxx/lib/python3.10/site-packages/trytond/model/modelstorage.py", line 466, in copy data = convert_data(field_defs, values[id_], default_values) File "/home/pokoli/.virtualenvs/xxxxx/lib/python3.10/site-packages/trytond/model/modelstorage.py", line 406, in convert_data data[field_name] = default[field_name](origin) File "/home/pokoli/.virtualenvs/xxxxx/lib/python3.10/site-packages/trytond/modules/stock/move.py", line 1020, in get_default return values[data['id']][name] KeyError: 'product' ``` This seems related to #9802 The problem is that we call copy with to different sets of default values. One containing the product field and the other not. The second does not contain the product, as it is a consumable product which only contains [the location in the to_pick key](https://foss.heptapod.net/tryton/tryton/-/blob/989eeee984e48b6e4bcff50cfcff270921c8572d/modules/stock/move.py#L941).
issue