'This will handle the irreconciable quants created by a force availability followed by a
return. When generating the moves of an inventory line, we look for quants of this line\'s
product created to compensate a force availability. If there are some and if the quant
which it is propagated from is still in the same location, we move it to the inventory
adjustment location before getting it back. Getting the quantity from the inventory
location will allow the negative quant to be compensated.'

def _fixup_negative_quants(self):

    self.ensure_one()
    for quant in self._get_quants().filtered((lambda q: (q.propagated_from_id.location_id.id == self.location_id.id))):
        move_out_vals = self._get_move_values(quant.qty, self.location_id.id, self.product_id.property_stock_inventory.id)
        move_out = self.env['stock.move'].create(move_out_vals)
        self.env['stock.quant'].quants_reserve([(quant, quant.qty)], move_out)
        move_out.action_done()
        move_in_vals = self._get_move_values(quant.qty, self.product_id.property_stock_inventory.id, self.location_id.id)
        move_in = self.env['stock.move'].create(move_in_vals)
        move_in.action_done()
