I need to add a value to the following method.
def _get_inventory_move_values(self, qty, location_id, location_dest_id, out=False):
""" Called when user manually set a new quantity (via `inventory_quantity`)
just before creating the corresponding stock move.
:param location_id: `stock.location`
:param location_dest_id: `stock.location`
:param out: boolean to set on True when the move go to inventory adjustment location.
:return: dict with all values needed to create a new `stock.move` with its move line.
"""
self.ensure_one()
if fields.Float.is_zero(qty, 0, precision_rounding=self.product_uom_id.rounding):
name = _('Product Quantity Confirmed')
else:
name = _('Product Quantity Updated')
return {
'name': self.env.context.get('inventory_name') or name,
'product_id': self.product_id.id,
'product_uom': self.product_uom_id.id,
'product_uom_qty': qty,
'company_id': self.company_id.id or self.env.company.id,
'state': 'confirmed',
'location_id': location_id.id,
'location_dest_id': location_dest_id.id,
'is_inventory': True,
'move_line_ids': [(0, 0, {
'product_id': self.product_id.id,
'product_uom_id': self.product_uom_id.id,
'qty_done': qty,
'location_id': location_id.id,
'location_dest_id': location_dest_id.id,
'company_id': self.company_id.id or self.env.company.id,
'lot_id': self.lot_id.id,
'package_id': out and self.package_id.id or False,
'result_package_id': (not out) and self.package_id.id or False,
'owner_id': self.owner_id.id,
})]
}
where the new value will be tl_adj_reas_id : self.tl_adj_reas_id
My thinking is along the line of
def _get_inventory_move_values(self, qty, location_id, location_dest_id, out=False): result = super()._get_inventory_move_values(self, qty, location_id, location_dest_id, out=False)
result.move_line_ids.update(tl_adj_reas_id : self.tl_adj_reas_id)
return result
But I know that this is incomplete.