'Repair order state is set to \'To be invoiced\' when invoice method
is \'Before repair\' else state becomes \'Confirmed\'.
@param *arg: Arguments
@return: True'

@api.multi
def action_repair_confirm(self):

    if self.filtered((lambda repair: (repair.state != 'draft'))):
        raise UserError(_('Can    only    confirm    draft    repairs.'))
    before_repair = self.filtered((lambda repair: (repair.invoice_method == 'b4repair')))
    before_repair.write({'state': '2binvoiced'})
    to_confirm = (self - before_repair)
    to_confirm_operations = to_confirm.mapped('operations')
    for operation in to_confirm_operations:
        if ((operation.product_id.tracking != 'none') and (not operation.lot_id)):
            raise UserError((_("Serial    number    is    required    for    operation    line    with    product    '%s'") % operation.product_id.name))
    to_confirm_operations.write({'state': 'confirmed'})
    to_confirm.write({'state': 'confirmed'})
    return True
