'On change of operation type it sets source location, destination location
and to invoice field.
@param product: Changed operation type.
@param guarantee_limit: Guarantee limit of current record.
@return: Dictionary of values.'

@api.onchange('type', 'repair_id')
def onchange_operation_type(self):

    if (not self.type):
        self.location_id = False
        self.Location_dest_id = False
    elif (self.type == 'add'):
        args = ((self.repair_id.company_id and [('company_id', '=', self.repair_id.company_id.id)]) or [])
        warehouse = self.env['stock.warehouse'].search(args, limit=1)
        self.location_id = warehouse.lot_stock_id
        self.location_dest_id = self.env['stock.location'].search([('usage', '=', 'production')], limit=1).id
        self.to_invoice = (self.repair_id.guarantee_limit and (datetime.strptime(self.repair_id.guarantee_limit, '%Y-%m-%d') < datetime.now()))
    else:
        self.location_id = self.env['stock.location'].search([('usage', '=', 'production')], limit=1).id
        self.location_dest_id = self.env['stock.location'].search([('scrap_location', '=', True)], limit=1).id
        self.to_invoice = False
