Context:
Hi, I'm trying to make a computed field that sums up another computed field inside move_line_ids_without_package in the module stock.picking
In the list view of move_line_ids_without_package I created a field called sale_price that calculates the total of the sale price of the sale order and multiplies it by the qty_done giving me the total.
Now. I computed another field called x_studio_total_entrega_iva hosted out of the list view in stock.picking.
Field name: x_studio_total_entrega_iva
Model: Transfer
Field type: float
Dependencies: location_id
Compute:
for record in self:
if 'move_line_ids_without_package' in self._fields:
for precio in self.move_line_ids_without_package:
recor['s_studio_total_entrega_iva'] += precio.sales_price
else:
record['x_studio_total_entrega_iva'] = -1.0
Problem:
On transfers / delivery orders that are validated or Done the computed field works just fine.
On those that are Drafts, Waiting, or Cancelled and an error occurs that cannot compute the field because there isn't move_line_ids_without_package displayed.
The error also occurs when trying to create an internal transfer between warehouses.
Traceback (most recent call last): File "/home/odoo/src/odoo/14.0/odoo/http.py", line 641, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/home/odoo/src/odoo/14.0/odoo/http.py", line 317, in _handle_exception raise exception.with_traceback(None) from new_cause ValueError: Compute method failed to assign stock.picking(2386,).x_studio_total_entrega_iva
Any insights would be appreciate it or possible solutions.